webpacker 3.4.3 → 3.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +3 -4
- data/CHANGELOG.md +19 -2
- data/Gemfile.lock +2 -2
- data/MIT-LICENSE +1 -1
- data/README.md +10 -10
- data/docs/cloud9.md +1 -1
- data/docs/webpack.md +1 -1
- data/lib/install/angular.rb +2 -2
- data/lib/install/bin/webpack +1 -1
- data/lib/install/bin/webpack-dev-server +1 -1
- data/lib/install/coffee.rb +1 -1
- data/lib/install/examples/erb/hello_erb.js.erb +2 -2
- data/lib/install/template.rb +2 -2
- data/lib/install/vue.rb +3 -3
- data/lib/tasks/webpacker.rake +1 -0
- data/lib/tasks/webpacker/info.rake +19 -0
- data/lib/webpacker.rb +1 -1
- data/lib/webpacker/compiler.rb +8 -2
- data/lib/webpacker/dev_server.rb +1 -1
- data/lib/webpacker/dev_server_proxy.rb +4 -0
- data/lib/webpacker/helper.rb +10 -0
- data/lib/webpacker/railtie.rb +2 -1
- data/lib/webpacker/version.rb +1 -1
- data/package.json +1 -1
- data/package/__tests__/config.js +17 -1
- data/package/config.js +9 -1
- data/test/compiler_test.rb +30 -1
- data/test/helper_test.rb +6 -0
- data/webpacker.gemspec +5 -0
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9b38dd5e5e609e48bee3589f53bb988a48d72510e5ebf3917cec8d88c1a4fa5e
|
4
|
+
data.tar.gz: 4b85f5b352d328615976f4351df62e7cd8be3c0a06a6a33d5e31b37c6ed8743d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 81c64d85696ae88767992c32e6b841fde0c7280a9b7de057b8bab3b66d2e29e211afdf804362c8c2b93858905f0bc0d44b6d92f09bef7f21704e21d3cbe2d7b4
|
7
|
+
data.tar.gz: 6cfa6629708dc2d4c2bd080dc3d2ce5ddb99409fa448234db4da155edb38152833beb6f40389719db8f411d8dfe837a3e700a4f9736be7a35660b7b09b3ea9b6
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,21 @@
|
|
1
|
-
**Please note that Webpacker 3.1.0 and 3.1.1
|
1
|
+
**Please note that Webpacker 3.1.0 and 3.1.1 have some serious bugs so please consider using either 3.0.2 or 3.2.0**
|
2
|
+
|
3
|
+
## [3.5.0] - 2018-04-29
|
4
|
+
|
5
|
+
### Fixed
|
6
|
+
- Remove compilation digest file if webpack command fails [#1399](https://github.com/rails/webpacker/pull/1399)
|
7
|
+
- Handle http dev_server setting properly in the proxy [#1420]
|
8
|
+
- Use correct protocol [#1425](https://github.com/rails/webpacker/pull/1425)
|
9
|
+
|
10
|
+
### Added
|
11
|
+
- `image_pack_tag` helper [#1400](https://github.com/rails/webpacker/pull/1400)
|
12
|
+
- devserver proxy for custom environments [#1415](https://github.com/rails/webpacker/pull/1415)
|
13
|
+
- Rails webpacker:info task [#1416](https://github.com/rails/webpacker/pull/1416)
|
14
|
+
(https://github.com/rails/webpacker/pull/1420)
|
15
|
+
- Include `RAILS_RELATIVE_URL_ROOT` environment variable in publicPath [#1428](https://github.com/rails/webpacker/pull/1428)
|
16
|
+
|
17
|
+
Complete list of changes: [#1464](https://github.com/rails/webpacker/pull/1464)
|
18
|
+
|
2
19
|
|
3
20
|
## [3.4.3] - 2018-04-3
|
4
21
|
|
@@ -37,7 +54,7 @@
|
|
37
54
|
|
38
55
|
### Breaking changes
|
39
56
|
|
40
|
-
- Fixes #1281 by installing binstubs only as local executables. To upgrade:
|
57
|
+
- Fixes [#1281](https://github.com/rails/webpacker/issues/1281) by installing binstubs only as local executables. To upgrade:
|
41
58
|
|
42
59
|
```
|
43
60
|
bundle exec rails webpacker:binstubs
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
webpacker (3.
|
4
|
+
webpacker (3.5.0)
|
5
5
|
activesupport (>= 4.2)
|
6
6
|
rack-proxy (>= 0.6.1)
|
7
7
|
railties (>= 4.2)
|
@@ -57,7 +57,7 @@ GEM
|
|
57
57
|
activesupport (>= 4.2.0)
|
58
58
|
i18n (0.9.5)
|
59
59
|
concurrent-ruby (~> 1.0)
|
60
|
-
loofah (2.2.
|
60
|
+
loofah (2.2.2)
|
61
61
|
crass (~> 1.0.2)
|
62
62
|
nokogiri (>= 1.5.9)
|
63
63
|
mail (2.7.0)
|
data/MIT-LICENSE
CHANGED
data/README.md
CHANGED
@@ -81,7 +81,7 @@ Or add it to your `Gemfile`:
|
|
81
81
|
|
82
82
|
```ruby
|
83
83
|
# Gemfile
|
84
|
-
gem 'webpacker', '~> 3.
|
84
|
+
gem 'webpacker', '~> 3.5'
|
85
85
|
|
86
86
|
# OR if you prefer to use master
|
87
87
|
gem 'webpacker', git: 'https://github.com/rails/webpacker.git'
|
@@ -154,7 +154,7 @@ in the `app/javascript/packs/*.js` files and automatically reload the browser to
|
|
154
154
|
./bin/webpack-dev-server
|
155
155
|
|
156
156
|
# watcher
|
157
|
-
./bin/webpack --colors --progress
|
157
|
+
./bin/webpack --watch --colors --progress
|
158
158
|
|
159
159
|
# standalone build
|
160
160
|
./bin/webpack
|
@@ -186,7 +186,7 @@ WEBPACKER_DEV_SERVER_HOST=0.0.0.0 ./bin/webpack-dev-server
|
|
186
186
|
**Note:** You need to allow webpack-dev-server host as an allowed origin for `connect-src` if you are running your application in a restrict CSP environment (like Rails 5.2+). This can be done in Rails 5.2+ in the CSP initializer `config/initializers/content_security_policy.rb` with a snippet like this:
|
187
187
|
|
188
188
|
```ruby
|
189
|
-
|
189
|
+
policy.connect_src :self, :https, 'http://localhost:3035', 'ws://localhost:3035' if Rails.env.development?
|
190
190
|
```
|
191
191
|
|
192
192
|
**Note:** Don't forget to prefix `ruby` when running these binstubs on Windows
|
@@ -248,7 +248,7 @@ bundle exec rails webpacker:compile
|
|
248
248
|
|
249
249
|
### Upgrading
|
250
250
|
|
251
|
-
You can run following commands to upgrade Webpacker to the latest stable version. This process involves upgrading the gem and related
|
251
|
+
You can run following commands to upgrade Webpacker to the latest stable version. This process involves upgrading the gem and related JavaScript packages:
|
252
252
|
|
253
253
|
```bash
|
254
254
|
bundle update webpacker
|
@@ -258,7 +258,7 @@ yarn add webpack-dev-server@^2.11.1
|
|
258
258
|
|
259
259
|
### Yarn Integrity
|
260
260
|
|
261
|
-
By default, in development, webpacker runs a yarn integrity check to ensure that all local
|
261
|
+
By default, in development, webpacker runs a yarn integrity check to ensure that all local JavaScript packages are up-to-date. This is similar to what bundler does currently in Rails, but for JavaScript packages. If your system is out of date, then Rails will not initialize. You will be asked to upgrade your local JavaScript packages by running `yarn install`.
|
262
262
|
|
263
263
|
To turn off this option, you will need to override the default by adding a new config option to your Rails development environment configuration file (`config/environment/development.rb`):
|
264
264
|
|
@@ -324,9 +324,9 @@ with the following code:
|
|
324
324
|
|
325
325
|
```ruby
|
326
326
|
if Rails.env.development?
|
327
|
-
|
327
|
+
policy.script_src :self, :https, :unsafe_eval
|
328
328
|
else
|
329
|
-
|
329
|
+
policy.script_src :self, :https
|
330
330
|
end
|
331
331
|
```
|
332
332
|
|
@@ -352,9 +352,9 @@ configuration:
|
|
352
352
|
|
353
353
|
```ruby
|
354
354
|
if Rails.env.development?
|
355
|
-
|
355
|
+
policy.script_src :self, :https, :unsafe_eval
|
356
356
|
else
|
357
|
-
|
357
|
+
policy.script_src :self, :https
|
358
358
|
end
|
359
359
|
```
|
360
360
|
You can read more about this in the [Vue docs](https://vuejs.org/v2/guide/installation.html#CSP-environments).
|
@@ -486,7 +486,7 @@ Webpacker::Compiler.watched_paths << 'bower_components'
|
|
486
486
|
|
487
487
|
## Deployment
|
488
488
|
|
489
|
-
Webpacker hooks up a new `webpacker:compile` task to `assets:precompile`, which gets run whenever you run `assets:precompile`. If you are not using Sprockets, `webpacker:compile` is automatically aliased to `assets:precompile`.
|
489
|
+
Webpacker hooks up a new `webpacker:compile` task to `assets:precompile`, which gets run whenever you run `assets:precompile`. If you are not using Sprockets, `webpacker:compile` is automatically aliased to `assets:precompile`. Similar to sprockets both rake tasks will compile packs in production mode but will use `RAILS_ENV` to load configuration from `config/webpacker.yml` (if available).
|
490
490
|
|
491
491
|
## Docs
|
492
492
|
|
data/docs/cloud9.md
CHANGED
data/docs/webpack.md
CHANGED
@@ -29,7 +29,7 @@ module.exports = {
|
|
29
29
|
}
|
30
30
|
|
31
31
|
// config/webpack/environment.js
|
32
|
-
const environment = require('
|
32
|
+
const { environment } = require('@rails/webpacker')
|
33
33
|
const customConfig = require('./custom')
|
34
34
|
|
35
35
|
// Set nested object prop using path notation
|
data/lib/install/angular.rb
CHANGED
@@ -14,9 +14,9 @@ if Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR > 1
|
|
14
14
|
say "This can be done in Rails 5.2+ for development environment in the CSP initializer", :yellow
|
15
15
|
say "config/initializers/content_security_policy.rb with a snippet like this:", :yellow
|
16
16
|
say "if Rails.env.development?", :yellow
|
17
|
-
say "
|
17
|
+
say " policy.script_src :self, :https, :unsafe_eval", :yellow
|
18
18
|
say "else", :yellow
|
19
|
-
say "
|
19
|
+
say " policy.script_src :self, :https", :yellow
|
20
20
|
say "end", :yellow
|
21
21
|
end
|
22
22
|
|
data/lib/install/bin/webpack
CHANGED
data/lib/install/coffee.rb
CHANGED
@@ -22,4 +22,4 @@ copy_file "#{__dir__}/examples/coffee/hello_coffee.coffee",
|
|
22
22
|
say "Installing all Coffeescript dependencies"
|
23
23
|
run "yarn add coffeescript@1.12.7 coffee-loader"
|
24
24
|
|
25
|
-
say "Webpacker now supports
|
25
|
+
say "Webpacker now supports Coffeescript 🎉", :green
|
@@ -1,5 +1,5 @@
|
|
1
|
-
// Run this example by adding
|
2
|
-
// like app/views/layouts/application.html.erb.
|
1
|
+
// Run this example by adding <%%= javascript_pack_tag 'hello_erb' %> to the head of your layout file,
|
2
|
+
// like app/views/layouts/application.html.erb. Don't forget to uncomment erb tag after adding it to your layout file.
|
3
3
|
|
4
4
|
<% name = 'Erb' %>
|
5
5
|
|
data/lib/install/template.rb
CHANGED
@@ -19,7 +19,7 @@ say "Adding configurations"
|
|
19
19
|
|
20
20
|
check_yarn_integrity_config = ->(value) { <<CONFIG }
|
21
21
|
# Verifies that versions and hashed value of the package contents in the project's package.json
|
22
|
-
|
22
|
+
config.webpacker.check_yarn_integrity = #{value}
|
23
23
|
CONFIG
|
24
24
|
|
25
25
|
if Rails::VERSION::MAJOR >= 5
|
@@ -50,7 +50,7 @@ if Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR > 1
|
|
50
50
|
say "You need to allow webpack-dev-server host as allowed origin for connect-src.", :yellow
|
51
51
|
say "This can be done in Rails 5.2+ for development environment in the CSP initializer", :yellow
|
52
52
|
say "config/initializers/content_security_policy.rb with a snippet like this:", :yellow
|
53
|
-
say "
|
53
|
+
say "policy.connect_src :self, :https, \"http://localhost:3035\", \"ws://localhost:3035\" if Rails.env.development?", :yellow
|
54
54
|
end
|
55
55
|
|
56
56
|
say "Webpacker successfully installed 🎉 🍰", :green
|
data/lib/install/vue.rb
CHANGED
@@ -24,16 +24,16 @@ copy_file "#{__dir__}/examples/vue/app.vue",
|
|
24
24
|
"#{Webpacker.config.source_path}/app.vue"
|
25
25
|
|
26
26
|
say "Installing all Vue dependencies"
|
27
|
-
run "yarn add vue vue-loader vue-template-compiler"
|
27
|
+
run "yarn add vue vue-loader@14.2.2 vue-template-compiler"
|
28
28
|
|
29
29
|
if Rails::VERSION::MAJOR == 5 && Rails::VERSION::MINOR > 1
|
30
30
|
say "You need to enable unsafe-eval rule.", :yellow
|
31
31
|
say "This can be done in Rails 5.2+ for development environment in the CSP initializer", :yellow
|
32
32
|
say "config/initializers/content_security_policy.rb with a snippet like this:", :yellow
|
33
33
|
say "if Rails.env.development?", :yellow
|
34
|
-
say "
|
34
|
+
say " policy.script_src :self, :https, :unsafe_eval", :yellow
|
35
35
|
say "else", :yellow
|
36
|
-
say "
|
36
|
+
say " policy.script_src :self, :https", :yellow
|
37
37
|
say "end", :yellow
|
38
38
|
end
|
39
39
|
|
data/lib/tasks/webpacker.rake
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
tasks = {
|
2
|
+
"webpacker:info" => "Provides information on Webpacker's environment",
|
2
3
|
"webpacker:install" => "Installs and setup webpack with Yarn",
|
3
4
|
"webpacker:compile" => "Compiles webpack bundles based on environment",
|
4
5
|
"webpacker:clobber" => "Removes the webpack compiled output directory",
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require "webpacker/version"
|
2
|
+
|
3
|
+
namespace :webpacker do
|
4
|
+
desc "Provide information on Webpacker's environment"
|
5
|
+
task :info do
|
6
|
+
$stdout.puts "Ruby: #{`ruby --version`}"
|
7
|
+
$stdout.puts "Rails: #{Rails.version}"
|
8
|
+
$stdout.puts "Webpacker: #{Webpacker::VERSION}"
|
9
|
+
$stdout.puts "Node: #{`node --version`}"
|
10
|
+
$stdout.puts "Yarn: #{`yarn --version`}"
|
11
|
+
|
12
|
+
$stdout.puts "\n"
|
13
|
+
$stdout.puts "@rails/webpacker: \n#{`npm list @rails/webpacker version`}"
|
14
|
+
|
15
|
+
$stdout.puts "Is bin/webpack present?: #{File.exist? 'bin/webpack'}"
|
16
|
+
$stdout.puts "Is bin/webpack-dev-server present?: #{File.exist? 'bin/webpack-dev-server'}"
|
17
|
+
$stdout.puts "Is bin/yarn present?: #{File.exist? 'bin/yarn'}"
|
18
|
+
end
|
19
|
+
end
|
data/lib/webpacker.rb
CHANGED
data/lib/webpacker/compiler.rb
CHANGED
@@ -19,7 +19,9 @@ class Webpacker::Compiler
|
|
19
19
|
def compile
|
20
20
|
if stale?
|
21
21
|
record_compilation_digest
|
22
|
-
run_webpack
|
22
|
+
run_webpack.tap do |success|
|
23
|
+
remove_compilation_digest if !success
|
24
|
+
end
|
23
25
|
else
|
24
26
|
true
|
25
27
|
end
|
@@ -50,10 +52,14 @@ class Webpacker::Compiler
|
|
50
52
|
compilation_digest_path.write(watched_files_digest)
|
51
53
|
end
|
52
54
|
|
55
|
+
def remove_compilation_digest
|
56
|
+
compilation_digest_path.delete if compilation_digest_path.exist?
|
57
|
+
end
|
58
|
+
|
53
59
|
def run_webpack
|
54
60
|
logger.info "Compiling…"
|
55
61
|
|
56
|
-
|
62
|
+
stdout, sterr , status = Open3.capture3(webpack_env, "#{RbConfig.ruby} ./bin/webpack")
|
57
63
|
|
58
64
|
if status.success?
|
59
65
|
logger.info "Compiled all packs in #{config.public_output_path}"
|
data/lib/webpacker/dev_server.rb
CHANGED
@@ -11,6 +11,10 @@ class Webpacker::DevServerProxy < Rack::Proxy
|
|
11
11
|
def perform_request(env)
|
12
12
|
if env["PATH_INFO"].start_with?("/#{public_output_uri_path}") && Webpacker.dev_server.running?
|
13
13
|
env["HTTP_HOST"] = env["HTTP_X_FORWARDED_HOST"] = env["HTTP_X_FORWARDED_SERVER"] = Webpacker.dev_server.host_with_port
|
14
|
+
env["HTTP_X_FORWARDED_PROTO"] = env["HTTP_X_FORWARDED_SCHEME"] = Webpacker.dev_server.protocol
|
15
|
+
unless Webpacker.dev_server.https?
|
16
|
+
env["HTTPS"] = env["HTTP_X_FORWARDED_SSL"] = "off"
|
17
|
+
end
|
14
18
|
env["SCRIPT_NAME"] = ""
|
15
19
|
|
16
20
|
super(env)
|
data/lib/webpacker/helper.rb
CHANGED
@@ -33,6 +33,16 @@ module Webpacker::Helper
|
|
33
33
|
end
|
34
34
|
end
|
35
35
|
|
36
|
+
# Creates a image tag that references the named pack file.
|
37
|
+
#
|
38
|
+
# Example:
|
39
|
+
#
|
40
|
+
# <%= image_pack_tag 'application.png', size: '16x10', alt: 'Edit Entry' %>
|
41
|
+
# <img alt='Edit Entry' src='/packs/application-k344a6d59eef8632c9d1.png' width='16' height='10' />
|
42
|
+
def image_pack_tag(name, **options)
|
43
|
+
image_tag(asset_path(Webpacker.manifest.lookup!(name)), **options)
|
44
|
+
end
|
45
|
+
|
36
46
|
# Creates a script tag that references the named pack file, as compiled by webpack per the entries list
|
37
47
|
# in config/webpack/shared.js. By default, this list is auto-generated to match everything in
|
38
48
|
# app/javascript/packs/*.js. In production mode, the digested reference is automatically looked up.
|
data/lib/webpacker/railtie.rb
CHANGED
@@ -46,7 +46,8 @@ class Webpacker::Engine < ::Rails::Engine
|
|
46
46
|
end
|
47
47
|
|
48
48
|
initializer "webpacker.proxy" do |app|
|
49
|
-
|
49
|
+
insert_middleware = Webpacker.config.dev_server.present? rescue nil
|
50
|
+
if insert_middleware
|
50
51
|
app.middleware.insert_before 0,
|
51
52
|
Rails::VERSION::MAJOR >= 5 ?
|
52
53
|
Webpacker::DevServerProxy : "Webpacker::DevServerProxy", ssl_verify_none: true
|
data/lib/webpacker/version.rb
CHANGED
data/package.json
CHANGED
data/package/__tests__/config.js
CHANGED
@@ -1,14 +1,30 @@
|
|
1
1
|
/* global test expect, describe */
|
2
2
|
|
3
|
-
const {
|
3
|
+
const { chdirCwd, chdirTestApp } = require('../utils/helpers')
|
4
4
|
|
5
5
|
chdirTestApp()
|
6
6
|
|
7
7
|
const config = require('../config')
|
8
8
|
|
9
9
|
describe('Config', () => {
|
10
|
+
beforeEach(() => jest.resetModules())
|
10
11
|
afterAll(chdirCwd)
|
11
12
|
|
13
|
+
test('public path', () => {
|
14
|
+
process.env.RAILS_ENV = 'development'
|
15
|
+
delete process.env.RAILS_RELATIVE_URL_ROOT
|
16
|
+
const config = require('../config')
|
17
|
+
expect(config.publicPath).toEqual('/packs/')
|
18
|
+
})
|
19
|
+
|
20
|
+
// also tests removal of extra slashes
|
21
|
+
test('public path with relative root', () => {
|
22
|
+
process.env.RAILS_ENV = 'development'
|
23
|
+
process.env.RAILS_RELATIVE_URL_ROOT = '/foo'
|
24
|
+
const config = require('../config')
|
25
|
+
expect(config.publicPath).toEqual('/foo/packs/')
|
26
|
+
})
|
27
|
+
|
12
28
|
test('should return extensions as listed in app config', () => {
|
13
29
|
expect(config.extensions).toEqual([
|
14
30
|
'.js',
|
data/package/config.js
CHANGED
@@ -20,6 +20,14 @@ if (isArray(app.extensions) && app.extensions.length) delete defaults.extensions
|
|
20
20
|
|
21
21
|
const config = deepMerge(defaults, app)
|
22
22
|
config.outputPath = resolve('public', config.public_output_path)
|
23
|
-
|
23
|
+
|
24
|
+
let publicPath = `/${config.public_output_path}/`
|
25
|
+
// Add prefix to publicPath.
|
26
|
+
if (process.env.RAILS_RELATIVE_URL_ROOT) {
|
27
|
+
publicPath = `/${process.env.RAILS_RELATIVE_URL_ROOT}${publicPath}`
|
28
|
+
}
|
29
|
+
|
30
|
+
// Remove extra slashes.
|
31
|
+
config.publicPath = publicPath.replace(/(^\/|[^:]\/)\/+/g, '$1')
|
24
32
|
|
25
33
|
module.exports = config
|
data/test/compiler_test.rb
CHANGED
@@ -1,12 +1,20 @@
|
|
1
1
|
require "test_helper"
|
2
2
|
|
3
3
|
class CompilerTest < Minitest::Test
|
4
|
-
def
|
4
|
+
def remove_compilation_digest_path
|
5
5
|
Webpacker.compiler.send(:compilation_digest_path).tap do |path|
|
6
6
|
path.delete if path.exist?
|
7
7
|
end
|
8
8
|
end
|
9
9
|
|
10
|
+
def setup
|
11
|
+
remove_compilation_digest_path
|
12
|
+
end
|
13
|
+
|
14
|
+
def teardown
|
15
|
+
remove_compilation_digest_path
|
16
|
+
end
|
17
|
+
|
10
18
|
def test_custom_environment_variables
|
11
19
|
assert Webpacker.compiler.send(:webpack_env)["FOO"] == nil
|
12
20
|
Webpacker.compiler.env["FOO"] = "BAR"
|
@@ -29,6 +37,27 @@ class CompilerTest < Minitest::Test
|
|
29
37
|
assert !Webpacker.compiler.fresh?
|
30
38
|
end
|
31
39
|
|
40
|
+
def test_freshness_on_compile_success
|
41
|
+
status = OpenStruct.new(success?: true)
|
42
|
+
|
43
|
+
assert Webpacker.compiler.stale?
|
44
|
+
Open3.stub :capture3, [:sterr, :stdout, status] do
|
45
|
+
Webpacker.compiler.compile
|
46
|
+
assert Webpacker.compiler.fresh?
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def test_staleness_on_compile_fail
|
51
|
+
status = OpenStruct.new(success?: false)
|
52
|
+
|
53
|
+
assert Webpacker.compiler.stale?
|
54
|
+
Open3.stub :capture3, [:sterr, :stdout, status] do
|
55
|
+
|
56
|
+
Webpacker.compiler.compile
|
57
|
+
assert Webpacker.compiler.stale?
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
32
61
|
def test_compilation_digest_path
|
33
62
|
assert Webpacker.compiler.send(:compilation_digest_path).to_s.ends_with?(Webpacker.env)
|
34
63
|
end
|
data/test/helper_test.rb
CHANGED
@@ -31,6 +31,12 @@ class HelperTest < ActionView::TestCase
|
|
31
31
|
assert_equal "https://example.com/packs/bootstrap-c38deda30895059837cf.css", asset_pack_url("bootstrap.css")
|
32
32
|
end
|
33
33
|
|
34
|
+
def test_image_pack_tag
|
35
|
+
assert_equal \
|
36
|
+
"<img alt=\"Edit Entry\" src=\"/packs/application-k344a6d59eef8632c9d1.png\" width=\"16\" height=\"10\" />",
|
37
|
+
image_pack_tag("application.png", size: "16x10", alt: "Edit Entry")
|
38
|
+
end
|
39
|
+
|
34
40
|
def test_javascript_pack_tag
|
35
41
|
assert_equal \
|
36
42
|
%(<script src="/packs/bootstrap-300631c4f0e0f9c865bc.js"></script>),
|
data/webpacker.gemspec
CHANGED
@@ -10,6 +10,11 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.homepage = "https://github.com/rails/webpacker"
|
11
11
|
s.license = "MIT"
|
12
12
|
|
13
|
+
s.metadata = {
|
14
|
+
"source_code_uri" => "https://github.com/rails/webpacker/tree/v#{Webpacker::VERSION}",
|
15
|
+
"changelog_uri" => "https://github.com/rails/webpacker/blob/v#{Webpacker::VERSION}/CHANGELOG.md"
|
16
|
+
}
|
17
|
+
|
13
18
|
s.required_ruby_version = ">= 2.2.0"
|
14
19
|
|
15
20
|
s.add_dependency "activesupport", ">= 4.2"
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webpacker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Heinemeier Hansson
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-04-
|
12
|
+
date: 2018-04-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -157,6 +157,7 @@ files:
|
|
157
157
|
- lib/tasks/webpacker/check_yarn.rake
|
158
158
|
- lib/tasks/webpacker/clobber.rake
|
159
159
|
- lib/tasks/webpacker/compile.rake
|
160
|
+
- lib/tasks/webpacker/info.rake
|
160
161
|
- lib/tasks/webpacker/install.rake
|
161
162
|
- lib/tasks/webpacker/verify_install.rake
|
162
163
|
- lib/tasks/webpacker/yarn_install.rake
|
@@ -235,7 +236,9 @@ files:
|
|
235
236
|
homepage: https://github.com/rails/webpacker
|
236
237
|
licenses:
|
237
238
|
- MIT
|
238
|
-
metadata:
|
239
|
+
metadata:
|
240
|
+
source_code_uri: https://github.com/rails/webpacker/tree/v3.5.0
|
241
|
+
changelog_uri: https://github.com/rails/webpacker/blob/v3.5.0/CHANGELOG.md
|
239
242
|
post_install_message:
|
240
243
|
rdoc_options: []
|
241
244
|
require_paths:
|