browserify-rails 3.1.0 → 3.2.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: 8fc080c61fe2b627b3bbbda924d2f9c26b47bfde
4
- data.tar.gz: b37b833f9fc8fa5bdc68880891c6d8db2c2a042c
3
+ metadata.gz: 4fb1f0ca991ae551e1d31c9ef7b573e110e7b753
4
+ data.tar.gz: 85237ceabbbb3d394f64f374fb8fd9eef56e9f85
5
5
  SHA512:
6
- metadata.gz: 1254b0e0c49f8e6ebeae8d1edc23f7fca5b846591b622588f7af2db5258ce9f145da0063dc8fb55e0edb34bea7b7acdb26f3df6885913961278d127a8399395a
7
- data.tar.gz: e0a6be283f1e0f65e1df78b34a95cb68058d05c33c586267d43e8ba62c58ada5e040d5031403432b0ede5ce8e2b70578a9e14aea297bdf005e366e3be71b886a
6
+ metadata.gz: 31cc31798d53574d9efeb951a3afbceb192d3295a25fddd73083c0bce8baec8ac1ef0fc41c544024c4ae2227e3d4f90ab54c12ecdc21f1fec0c94c30376cad76
7
+ data.tar.gz: 7ba23f9ce430091fa490b87ffe1b759b0426a0827b8ef434dee858271d34ebf11630b5ea1500566f7d5e0d4411b3ef745007a4ddd83bbf053031681b064541ea
data/CHANGELOG.md CHANGED
@@ -1,6 +1,14 @@
1
1
  # Change Log
2
2
  All notable changes to this project will be documented in this file going forward.
3
3
 
4
+ ## [3.2.0] - 2016-09-14
5
+ - make compatible with sprockets 4 (thanks marvwhere!)
6
+ - update dummy rails to use current browserify and browserify-incremental
7
+ - use Addressable gem for URI.escape instead of deprecated method
8
+ - replace uses of deprecated File.exists? with File.exist?
9
+ - make it easy to run each test file separately
10
+ - make it so the dummy rails is startable with Rails 5
11
+
4
12
  ## [3.1.0] - 2016-05-23
5
13
  - relax railties requirement to < 5.1
6
14
 
data/README.md CHANGED
@@ -196,6 +196,10 @@ If you wish to put the node_modules directory within the engine, you have some c
196
196
  config.browserify_rails.node_bin = "some/directory"
197
197
  ```
198
198
 
199
+ ### Example setup
200
+
201
+ Refer to this repo for setting up this gem with ES6 and all front-end goodies like react and all - [github.com/gauravtiwari/browserify-rails](https://github.com/gauravtiwari/browserify-rails)
202
+
199
203
  ## Support for rails asset directories as non-relative module sources
200
204
 
201
205
  In the Rails asset pipeline, it is common to have files in
@@ -226,7 +230,7 @@ buildpacks that run `bundle` and `npm install` on the target machine.
226
230
 
227
231
  $ heroku buildpacks:add https://github.com/heroku/heroku-buildpack-nodejs.git
228
232
  $ heroku buildpacks:add https://github.com/heroku/heroku-buildpack-ruby.git
229
-
233
+
230
234
  ## Using Browserify Transforms
231
235
 
232
236
  You can easily use a browserify transform by adding it to your `package.json`, then adding the transform flag to your `application.rb`, using `config.browserify_rails.commandline_options`. For example, here is how you can add ES6 support in your app:
@@ -21,6 +21,7 @@ Gem::Specification.new do |spec|
21
21
 
22
22
  spec.add_runtime_dependency "railties", ">= 4.0.0", "< 5.1"
23
23
  spec.add_runtime_dependency "sprockets", ">= 3.5.2"
24
+ spec.add_runtime_dependency "addressable", ">= 2.4.0"
24
25
 
25
26
  spec.add_development_dependency "bundler", ">= 1.3"
26
27
  spec.add_development_dependency "rake"
@@ -2,6 +2,7 @@ require "open3"
2
2
  require "fileutils"
3
3
  require "tempfile"
4
4
  require "shellwords"
5
+ require "addressable"
5
6
 
6
7
  module BrowserifyRails
7
8
  class BrowserifyProcessor
@@ -37,10 +38,14 @@ module BrowserifyRails
37
38
  # Signal dependencies to sprockets to ensure we track changes
38
39
  evaluate_dependencies(input[:environment].paths).each do |path|
39
40
  resolved = input[:environment].resolve(path)
40
- if config.evaluate_node_modules && !resolved
41
+
42
+ if resolved && resolved.is_a?(Array)
43
+ resolved = resolved[0]
44
+ elsif config.evaluate_node_modules && !resolved
41
45
  resolved = path
42
46
  end
43
- dependencies << "file-digest://#{URI.escape resolved}" if resolved
47
+
48
+ dependencies << "file-digest://#{Addressable::URI.escape resolved}" if resolved
44
49
  end
45
50
 
46
51
  new_data = run_browserify(input[:name])
@@ -73,12 +78,12 @@ module BrowserifyRails
73
78
  error = ->(cmd) { "Unable to run #{cmd}. Ensure you have installed it with npm." }
74
79
 
75
80
  # Browserify has to be installed in any case
76
- if !File.exists?(rails_path(browserify_cmd))
81
+ if !File.exist?(rails_path(browserify_cmd))
77
82
  raise BrowserifyRails::BrowserifyError.new(error.call(browserify_cmd))
78
83
  end
79
84
 
80
85
  # If the user wants to use browserifyinc, we need to ensure it's there too
81
- if config.use_browserifyinc && !File.exists?(rails_path(browserifyinc_cmd))
86
+ if config.use_browserifyinc && !File.exist?(rails_path(browserifyinc_cmd))
82
87
  raise BrowserifyRails::BrowserifyError.new(error.call(browserifyinc_cmd))
83
88
  end
84
89
  end
@@ -139,7 +144,7 @@ module BrowserifyRails
139
144
 
140
145
  list.lines.map(&:strip).select do |path|
141
146
  # Filter the temp file, where browserify caches the input stream
142
- File.exists?(path)
147
+ File.exist?(path)
143
148
  end
144
149
  end
145
150
  end
@@ -1,3 +1,3 @@
1
1
  module BrowserifyRails
2
- VERSION = "3.1.0"
2
+ VERSION = "3.2.0"
3
3
  end
@@ -1,4 +1,4 @@
1
- require 'test_helper'
1
+ require_relative 'test_helper'
2
2
 
3
3
  class BrowserifyProcessorTest < ActiveSupport::TestCase
4
4
  def stub_engine_config(hash)
@@ -1,4 +1,4 @@
1
- require "test_helper"
1
+ require_relative "test_helper"
2
2
 
3
3
  class BrowserifyTest < ActionDispatch::IntegrationTest
4
4
  def copy_example_file(filename, path = nil)
@@ -17,7 +17,7 @@ class BrowserifyTest < ActionDispatch::IntegrationTest
17
17
  Rails.application.assets.cache = Sprockets::Cache::MemoryStore.new
18
18
  BrowserifyRails::BrowserifyProcessor.instance.instance_variable_set(:@dependencies, nil)
19
19
  cache_file = File.join(Rails.root, "tmp/cache/browserify-rails/browserifyinc-cache.json")
20
- File.delete(cache_file) if File.exists?(cache_file)
20
+ File.delete(cache_file) if File.exist?(cache_file)
21
21
 
22
22
  copy_example_file "application.js.example"
23
23
  copy_example_file "foo.js.example"
@@ -4,7 +4,6 @@
4
4
  <title>Dummy</title>
5
5
  <%= stylesheet_link_tag "application" %>
6
6
  <%= javascript_include_tag "application" %>
7
- <%= javascript_include_tag "templates/test" %>
8
7
  <%= csrf_meta_tags %>
9
8
  </head>
10
9
  <body>
@@ -6,8 +6,8 @@
6
6
  "babel": "6.3.26",
7
7
  "babel-preset-es2015": "^6.6.0",
8
8
  "babelify": "7.2.0",
9
- "browserify": "6.3.4",
10
- "browserify-incremental": "3.0.1",
9
+ "browserify": "13.1.0",
10
+ "browserify-incremental": "3.1.1",
11
11
  "coffeeify": "2.0.1",
12
12
  "exorcist": "~> 0.3.0",
13
13
  "node-test-package": "~> 0.0.2"
@@ -1,6 +1,3 @@
1
- #!/usr/bin/env rbx
2
- # This command will automatically be run when you run "rails" with Rails 3 gems installed from the root of your application.
3
-
4
1
  APP_PATH = File.expand_path('../../config/application', __FILE__)
5
2
  require File.expand_path('../../config/boot', __FILE__)
6
3
  require 'rails/commands'
@@ -1,12 +1,12 @@
1
- (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({"__RAILS_ROOT__/app/assets/javascripts/_stream_0.js":[function(require,module,exports){
1
+ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2
2
  var foo = require('./foo');
3
3
  console.log(foo(11));
4
4
 
5
- },{"./foo":"__RAILS_ROOT__/app/assets/javascripts/foo.js"}],"__RAILS_ROOT__/app/assets/javascripts/foo.js":[function(require,module,exports){
5
+ },{"./foo":2}],2:[function(require,module,exports){
6
6
  require('./nested');
7
7
  module.exports = function (n) { return n * 11 }
8
8
 
9
- },{"./nested":"__RAILS_ROOT__/app/assets/javascripts/nested/index.js"}],"__RAILS_ROOT__/app/assets/javascripts/nested/index.js":[function(require,module,exports){
9
+ },{"./nested":3}],3:[function(require,module,exports){
10
10
  module.exports.NESTED = true;
11
11
 
12
- },{}]},{},["__RAILS_ROOT__/app/assets/javascripts/_stream_0.js"]);
12
+ },{}]},{},[1]);
@@ -1,15 +1,15 @@
1
- (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({"__RAILS_ROOT__/app/assets/javascripts/_stream_0.js":[function(require,module,exports){
1
+ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2
2
  var foo = require('./foo');
3
3
  var nodeTestPackage = require('node-test-package');
4
4
 
5
- },{"./foo":"__RAILS_ROOT__/app/assets/javascripts/foo.js","node-test-package":"__RAILS_ROOT__/node_modules/node-test-package/index.js"}],"__RAILS_ROOT__/app/assets/javascripts/foo.js":[function(require,module,exports){
5
+ },{"./foo":2,"node-test-package":4}],2:[function(require,module,exports){
6
6
  require('./nested');
7
7
  module.exports = function (n) { return n * 12 }
8
8
 
9
- },{"./nested":"__RAILS_ROOT__/app/assets/javascripts/nested/index.js"}],"__RAILS_ROOT__/app/assets/javascripts/nested/index.js":[function(require,module,exports){
9
+ },{"./nested":3}],3:[function(require,module,exports){
10
10
  module.exports.NESTED = true;
11
11
 
12
- },{}],"__RAILS_ROOT__/node_modules/node-test-package/index.js":[function(require,module,exports){
12
+ },{}],4:[function(require,module,exports){
13
13
  module.exports = console.log("hello friend");
14
14
 
15
- },{}]},{},["__RAILS_ROOT__/app/assets/javascripts/_stream_0.js"]);
15
+ },{}]},{},[1]);
@@ -1,15 +1,15 @@
1
- (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({"__RAILS_ROOT__/app/assets/javascripts/_stream_0.js":[function(require,module,exports){
1
+ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2
2
  var foo = require('./foo');
3
3
  var nodeTestPackage = require('node-test-package');
4
4
 
5
- },{"./foo":"__RAILS_ROOT__/app/assets/javascripts/foo.js","node-test-package":"__RAILS_ROOT__/node_modules/node-test-package/index.js"}],"__RAILS_ROOT__/app/assets/javascripts/foo.js":[function(require,module,exports){
5
+ },{"./foo":2,"node-test-package":4}],2:[function(require,module,exports){
6
6
  require('./nested');
7
7
  module.exports = function (n) { return n * 11 }
8
8
 
9
- },{"./nested":"__RAILS_ROOT__/app/assets/javascripts/nested/index.js"}],"__RAILS_ROOT__/app/assets/javascripts/nested/index.js":[function(require,module,exports){
9
+ },{"./nested":3}],3:[function(require,module,exports){
10
10
  module.exports.NESTED = true;
11
11
 
12
- },{}],"__RAILS_ROOT__/node_modules/node-test-package/index.js":[function(require,module,exports){
12
+ },{}],4:[function(require,module,exports){
13
13
  module.exports = console.log("goodbye friend");
14
14
 
15
- },{}]},{},["__RAILS_ROOT__/app/assets/javascripts/_stream_0.js"]);
15
+ },{}]},{},[1]);
@@ -1,15 +1,15 @@
1
- (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({"__RAILS_ROOT__/app/assets/javascripts/_stream_0.js":[function(require,module,exports){
1
+ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2
2
  var foo = require('./foo');
3
3
  var nodeTestPackage = require('node-test-package');
4
4
 
5
- },{"./foo":"__RAILS_ROOT__/app/assets/javascripts/foo.js","node-test-package":"__RAILS_ROOT__/node_modules/node-test-package/index.js"}],"__RAILS_ROOT__/app/assets/javascripts/foo.js":[function(require,module,exports){
5
+ },{"./foo":2,"node-test-package":4}],2:[function(require,module,exports){
6
6
  require('./nested');
7
7
  module.exports = function (n) { return n * 11 }
8
8
 
9
- },{"./nested":"__RAILS_ROOT__/app/assets/javascripts/nested/index.js"}],"__RAILS_ROOT__/app/assets/javascripts/nested/index.js":[function(require,module,exports){
9
+ },{"./nested":3}],3:[function(require,module,exports){
10
10
  module.exports.NESTED = true;
11
11
 
12
- },{}],"__RAILS_ROOT__/node_modules/node-test-package/index.js":[function(require,module,exports){
12
+ },{}],4:[function(require,module,exports){
13
13
  module.exports = console.log("hello friend");
14
14
 
15
- },{}]},{},["__RAILS_ROOT__/app/assets/javascripts/_stream_0.js"]);
15
+ },{}]},{},[1]);
@@ -1,16 +1,17 @@
1
- (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({"__RAILS_ROOT__/app/assets/javascripts/_stream_0.js":[function(require,module,exports){
1
+ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2
2
  var foo = require('./foo');
3
3
  var nodeTestPackage = require('node-test-package');
4
4
 
5
- },{"./foo":"__RAILS_ROOT__/app/assets/javascripts/foo.js","node-test-package":"__RAILS_ROOT__/node_modules/node-test-package/index.js"}],"__RAILS_ROOT__/app/assets/javascripts/foo.js":[function(require,module,exports){
5
+ },{"./foo":2,"node-test-package":4}],2:[function(require,module,exports){
6
6
  require('./nested');
7
7
  module.exports = function (n) { return n * 11 }
8
8
 
9
- },{"./nested":"__RAILS_ROOT__/app/assets/javascripts/nested/index.js"}],"__RAILS_ROOT__/app/assets/javascripts/nested/index.js":[function(require,module,exports){
9
+ },{"./nested":3}],3:[function(require,module,exports){
10
10
  module.exports.NESTED = true;
11
11
 
12
- },{}],"__RAILS_ROOT__/node_modules/node-test-package/index.js":[function(require,module,exports){
12
+ },{}],4:[function(require,module,exports){
13
13
  module.exports = console.log("hello friend");
14
14
 
15
- },{}]},{},["__RAILS_ROOT__/app/assets/javascripts/_stream_0.js"])
16
- //# sourceMappingURL=application.map
15
+ },{}]},{},[1])
16
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uLy4uLy4uL25vZGVfbW9kdWxlcy9icm93c2VyLXBhY2svX3ByZWx1ZGUuanMiLCJfc3RyZWFtXzAuanMiLCJmb28uanMiLCJuZXN0ZWQvaW5kZXguanMiLCIuLi8uLi8uLi9ub2RlX21vZHVsZXMvbm9kZS10ZXN0LXBhY2thZ2UvaW5kZXguanMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7QUNBQTtBQUNBO0FBQ0E7O0FDRkE7QUFDQTtBQUNBOztBQ0ZBO0FBQ0E7O0FDREE7QUFDQSIsImZpbGUiOiJnZW5lcmF0ZWQuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlc0NvbnRlbnQiOlsiKGZ1bmN0aW9uIGUodCxuLHIpe2Z1bmN0aW9uIHMobyx1KXtpZighbltvXSl7aWYoIXRbb10pe3ZhciBhPXR5cGVvZiByZXF1aXJlPT1cImZ1bmN0aW9uXCImJnJlcXVpcmU7aWYoIXUmJmEpcmV0dXJuIGEobywhMCk7aWYoaSlyZXR1cm4gaShvLCEwKTt2YXIgZj1uZXcgRXJyb3IoXCJDYW5ub3QgZmluZCBtb2R1bGUgJ1wiK28rXCInXCIpO3Rocm93IGYuY29kZT1cIk1PRFVMRV9OT1RfRk9VTkRcIixmfXZhciBsPW5bb109e2V4cG9ydHM6e319O3Rbb11bMF0uY2FsbChsLmV4cG9ydHMsZnVuY3Rpb24oZSl7dmFyIG49dFtvXVsxXVtlXTtyZXR1cm4gcyhuP246ZSl9LGwsbC5leHBvcnRzLGUsdCxuLHIpfXJldHVybiBuW29dLmV4cG9ydHN9dmFyIGk9dHlwZW9mIHJlcXVpcmU9PVwiZnVuY3Rpb25cIiYmcmVxdWlyZTtmb3IodmFyIG89MDtvPHIubGVuZ3RoO28rKylzKHJbb10pO3JldHVybiBzfSkiLCJ2YXIgZm9vID0gcmVxdWlyZSgnLi9mb28nKTtcbnZhciBub2RlVGVzdFBhY2thZ2UgPSByZXF1aXJlKCdub2RlLXRlc3QtcGFja2FnZScpO1xuIiwicmVxdWlyZSgnLi9uZXN0ZWQnKTtcbm1vZHVsZS5leHBvcnRzID0gZnVuY3Rpb24gKG4pIHsgcmV0dXJuIG4gKiAxMSB9XG4iLCJtb2R1bGUuZXhwb3J0cy5ORVNURUQgPSB0cnVlO1xuIiwibW9kdWxlLmV4cG9ydHMgPSBjb25zb2xlLmxvZyhcImhlbGxvIGZyaWVuZFwiKTtcbiJdfQ==
17
+ ;
@@ -1,11 +1,11 @@
1
- require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({"__RAILS_ROOT__/app/assets/javascripts/_stream_0.js":[function(require,module,exports){
1
+ require=(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2
2
  var library = require('./a_huge_library');
3
3
 
4
4
  module.exports = function() {
5
5
  console.log('library', library);
6
6
  };
7
7
 
8
- },{"./a_huge_library":"__RAILS_ROOT__/app/assets/javascripts/a_huge_library.js"}],"a_huge_library":[function(require,module,exports){
8
+ },{"./a_huge_library":"a_huge_library"}],"a_huge_library":[function(require,module,exports){
9
9
  // pretend this file is 1 MB
10
10
  //
11
11
  // app_main.js is going to require() it and browserify.yml is going to tell it to use --require on it
@@ -21,4 +21,4 @@ module.exports = function() {
21
21
 
22
22
  module.exports = "THIS IS A HUGE LIBRARY";
23
23
 
24
- },{}]},{},["__RAILS_ROOT__/app/assets/javascripts/_stream_0.js"]);
24
+ },{}]},{},[1]);
@@ -1,4 +1,4 @@
1
- (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({"__RAILS_ROOT__/app/assets/javascripts/_stream_0.js":[function(require,module,exports){
1
+ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2
2
  (function() {
3
3
  var f, hello;
4
4
 
@@ -10,11 +10,11 @@
10
10
 
11
11
  }).call(this);
12
12
 
13
- },{"./foo":"__RAILS_ROOT__/app/assets/javascripts/foo.js"}],"__RAILS_ROOT__/app/assets/javascripts/foo.js":[function(require,module,exports){
13
+ },{"./foo":2}],2:[function(require,module,exports){
14
14
  require('./nested');
15
15
  module.exports = function (n) { return n * 11 }
16
16
 
17
- },{"./nested":"__RAILS_ROOT__/app/assets/javascripts/nested/index.js"}],"__RAILS_ROOT__/app/assets/javascripts/nested/index.js":[function(require,module,exports){
17
+ },{"./nested":3}],3:[function(require,module,exports){
18
18
  module.exports.NESTED = true;
19
19
 
20
- },{}]},{},["__RAILS_ROOT__/app/assets/javascripts/_stream_0.js"]);
20
+ },{}]},{},[1]);
@@ -1,9 +1,9 @@
1
- (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({"__RAILS_ROOT__/app/assets/javascripts/_stream_0.js":[function(require,module,exports){
1
+ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2
2
  var answer = require('some_folder/answer');
3
3
 
4
4
  console.log('answer', answer);
5
5
 
6
- },{"some_folder/answer":"__RAILS_ROOT__/app/assets/javascripts/some_folder/answer.js"}],"__RAILS_ROOT__/app/assets/javascripts/some_folder/answer.js":[function(require,module,exports){
6
+ },{"some_folder/answer":2}],2:[function(require,module,exports){
7
7
  module.exports = 42;
8
8
 
9
- },{}]},{},["__RAILS_ROOT__/app/assets/javascripts/_stream_0.js"]);
9
+ },{}]},{},[1]);
@@ -1,4 +1,4 @@
1
- (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({"__RAILS_ROOT__/app/assets/javascripts/_stream_0.js":[function(require,module,exports){
1
+ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2
2
  var string = "good old, simple plain javascript. No fancy modules here";
3
3
 
4
- },{}]},{},["__RAILS_ROOT__/app/assets/javascripts/_stream_0.js"]);
4
+ },{}]},{},[1]);
@@ -1,11 +1,11 @@
1
- (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({"__RAILS_ROOT__/app/assets/javascripts/_stream_0.js":[function(require,module,exports){
1
+ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2
2
  var library = require('./a_huge_library');
3
3
 
4
4
  module.exports = function() {
5
5
  console.log('some problem', library);
6
6
  };
7
7
 
8
- },{"./a_huge_library":"/a_huge_library"}],"__RAILS_ROOT__/app/assets/javascripts/a_huge_library.js":[function(require,module,exports){
8
+ },{"./a_huge_library":"/a_huge_library"}],2:[function(require,module,exports){
9
9
  // pretend this file is 1 MB
10
10
  //
11
11
  // app_main.js is going to require() it and browserify.yml is going to tell it to use --require on it
@@ -21,4 +21,4 @@ module.exports = function() {
21
21
 
22
22
  module.exports = "THIS IS A HUGE LIBRARY";
23
23
 
24
- },{}]},{},["__RAILS_ROOT__/app/assets/javascripts/_stream_0.js"]);
24
+ },{}]},{},[1]);
@@ -1,4 +1,4 @@
1
- (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({"/Users/cvig/dev/browserify-rails/test/dummy/app/assets/javascripts/_stream_0.js":[function(require,module,exports){
1
+ (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
2
2
  'use strict';
3
3
 
4
4
  var _simple_module = require('./simple_module');
@@ -9,7 +9,7 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
9
9
 
10
10
  console.log((0, _simple_module2.default)());
11
11
 
12
- },{"./simple_module":"__RAILS_ROOT__/app/assets/javascripts/simple_module.js"}],"__RAILS_ROOT__/app/assets/javascripts/simple_module.js":[function(require,module,exports){
12
+ },{"./simple_module":2}],2:[function(require,module,exports){
13
13
  "use strict";
14
14
 
15
15
  Object.defineProperty(exports, "__esModule", {
@@ -20,4 +20,4 @@ exports.default = function () {
20
20
  return 42;
21
21
  };
22
22
 
23
- },{}]},{},["__RAILS_ROOT__/app/assets/javascripts/_stream_0.js"]);
23
+ },{}]},{},[1]);
data/test/test_helper.rb CHANGED
@@ -21,4 +21,10 @@ ActiveSupport::TestCase.class_eval do
21
21
  contents.gsub(/__RAILS_ROOT__/, Rails.root.to_s) if contents
22
22
  end
23
23
  end
24
+
25
+ def fix(filename, contents)
26
+ File.open(File.join(File.dirname(__FILE__), "fixtures", filename), "w") do |f|
27
+ f.write(contents)
28
+ end
29
+ end
24
30
  end
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: 3.1.0
4
+ version: 3.2.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: 2016-05-24 00:00:00.000000000 Z
11
+ date: 2016-09-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -44,6 +44,20 @@ dependencies:
44
44
  - - ">="
45
45
  - !ruby/object:Gem::Version
46
46
  version: 3.5.2
47
+ - !ruby/object:Gem::Dependency
48
+ name: addressable
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 2.4.0
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 2.4.0
47
61
  - !ruby/object:Gem::Dependency
48
62
  name: bundler
49
63
  requirement: !ruby/object:Gem::Requirement
@@ -255,7 +269,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
255
269
  version: '0'
256
270
  requirements: []
257
271
  rubyforge_project:
258
- rubygems_version: 2.6.4
272
+ rubygems_version: 2.5.1
259
273
  signing_key:
260
274
  specification_version: 4
261
275
  summary: 'Get the best of both worlds: Browserify + Rails = CommonJS Heaven'