browserify-rails 2.0.3 → 2.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5051cb1b96115f8c8d020164649ca895761caa08
4
- data.tar.gz: 0125b5f01c1d25aa75d3955f7736f61788bbd6d4
3
+ metadata.gz: 23f0a0342f7acba4c60dbb7e5d758713dad4edf9
4
+ data.tar.gz: 49f6c7c5d5f940270d34d0136039c8ecbfa8a2f0
5
5
  SHA512:
6
- metadata.gz: 490d690fa6e640f4493bb67183f2e9c4b126736884146b7166675373cf302b9a41b792b8cf3081c0f02608b2ec0dd349dec39f3f91a3611d715c16ec72e914d4
7
- data.tar.gz: e69de2ac275ebdaf00f3fd113a196cfcc84f7216d01b81b657bc106bb6364db64b1073cd0ca66cc8ba74a20b599931dba64728d904bf042c1513578038525858
6
+ metadata.gz: 8d670e6ee82fbb6af5dea6b966d6409f2598caf0f1347fc970d6be2445c9cb581930ba98d350ed4e8e91a57c1284a7ca20ad3f7b1bcd3e155895a2130666e990
7
+ data.tar.gz: 4e651ad7ab99cf329020a07be46824b016302235ea47febd7f60edac98238251e218937e7f3b2be9435332b43f8417ec31e8e2a6b94dc8ff168fcd7df2b4712a
data/CHANGELOG.md CHANGED
@@ -1,6 +1,9 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file going forward.
3
3
 
4
+ ## [2.1.0] - 2015-12-26
5
+ - fix some dependency issues (see PR #130)
6
+
4
7
  ## [2.0.3] - 2015-12-18
5
8
  - detection of CommonJS (require(.*)) now more stringent
6
9
  - update README about 2.x and react-rails
data/README.md CHANGED
@@ -54,6 +54,21 @@ var foo = require('./foo');
54
54
  console.log(foo(12));
55
55
  ```
56
56
 
57
+ #### Gotchas with `require` and `module.exports`
58
+
59
+ Do not put `module.exports` or `require()` in JavaScript comments or strings.
60
+ Doing so will certainly cause issues with compilation that are difficult to
61
+ track down.
62
+
63
+ This happens because browserify-rails works by parsing your JavaScript files for
64
+ these keywords that indicate whether it is a module, or is requiring a module.
65
+ If a file meets one of these criteria, browserify will compile the modules as
66
+ expected.
67
+
68
+ Because browserify-rails is working within the restraints of Ruby/Sprockets, the
69
+ parsing is done by Ruby and therefore does not know whether it is a JavaScript
70
+ string, comment, or function.
71
+
57
72
  ## CoffeeScript
58
73
 
59
74
  For CoffeeScript support, make sure to follow the standard rails
@@ -34,6 +34,9 @@ module BrowserifyRails
34
34
  # Signal dependencies to sprockets to ensure we track changes
35
35
  evaluate_dependencies(input[:environment].paths).each do |path|
36
36
  resolved = input[:environment].resolve(path)
37
+ if config.evaluate_node_modules && !resolved
38
+ resolved = path
39
+ end
37
40
  dependencies << "file-digest://#{resolved}" if resolved
38
41
  end
39
42
 
@@ -126,6 +129,11 @@ module BrowserifyRails
126
129
 
127
130
  # @return [<String>] Paths of files, that this file depends on
128
131
  def dependencies
132
+ if (@dependencies_source_file != file)
133
+ @dependencies = nil
134
+ @dependencies_source_file = file
135
+ end
136
+
129
137
  @dependencies ||= begin
130
138
  # We forcefully run browserify (avoiding browserifyinc) with the --list
131
139
  # option to get a list of files.
@@ -1,3 +1,3 @@
1
1
  module BrowserifyRails
2
- VERSION = "2.0.3"
2
+ VERSION = "2.1.0"
3
3
  end
@@ -10,7 +10,7 @@ class BrowserifyTest < ActionDispatch::IntegrationTest
10
10
  end
11
11
 
12
12
  setup do
13
- Rails.application.assets.cache = nil
13
+ Rails.application.assets.cache = Sprockets::Cache::MemoryStore.new
14
14
 
15
15
  # Reset config on each run
16
16
  Dummy::Application.config.browserify_rails.force = false
@@ -82,6 +82,9 @@ class BrowserifyTest < ActionDispatch::IntegrationTest
82
82
  test "asset pipeline should regenerate application.js when foo.js changes" do
83
83
  expected_output = fixture("application.out.js")
84
84
 
85
+ # get another js file before applciation.js to check that it appropriately clears the cached dependencies
86
+ get "/assets/main.js"
87
+
85
88
  get "/assets/application.js"
86
89
 
87
90
  assert_response :success
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: browserify-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.3
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henry Hsu, Cymen Vig
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-12-18 00:00:00.000000000 Z
11
+ date: 2015-12-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -326,3 +326,4 @@ test_files:
326
326
  - test/fixtures/require_in_a_comment.js
327
327
  - test/fixtures/secondary.out.js
328
328
  - test/test_helper.rb
329
+ has_rdoc: