browserify-rails 0.4.2 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/browserify-rails/browserify_processor.rb +1 -1
- data/lib/browserify-rails/version.rb +1 -1
- data/test/compilation_test.rb +0 -2
- data/test/dummy/package.json +1 -1
- data/test/fixtures/application.changed.out.js +2 -2
- data/test/fixtures/application.foo_changed.out.js +2 -2
- data/test/fixtures/application.out.js +2 -2
- data/test/fixtures/foo.out.js +2 -2
- data/test/fixtures/main.out.js +9 -11
- data/test/fixtures/mocha.js +2 -2
- data/test/fixtures/node_path_based_require.out.js +2 -2
- data/test/fixtures/secondary.out.js +18 -2
- metadata +20 -20
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 92cc91320466c3b1392909823b59c6477f3c635a
|
4
|
+
data.tar.gz: 399c280e1430f2c0cda0977cd9e6f25c6c886704
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1ba97bb7bdce77d0e05dcf65f5f09b68e6375788013cb6de6c675199ec422458ef17396fc345d8c84a7bbe5bb40cb1ec2831874e47ab512ffc11cd4a1ba7a24
|
7
|
+
data.tar.gz: dc5f427060167c6640d71511757a20c81dbb9d5df9080b7bd4896e5868381bb177c59841cd22dc8d17ffb1d97986fe883fed59f85a212fcb2064a39071c10a3d
|
@@ -55,7 +55,7 @@ module BrowserifyRails
|
|
55
55
|
# Be here as strict as possible, so that non-commonjs files are not
|
56
56
|
# preprocessed.
|
57
57
|
def commonjs_module?
|
58
|
-
data.to_s.include?("module.exports") || dependencies.length > 0
|
58
|
+
data.to_s.include?("module.exports") || data.present? && dependencies.length > 0
|
59
59
|
end
|
60
60
|
|
61
61
|
# This primarily filters out required files from node modules
|
data/test/compilation_test.rb
CHANGED
@@ -120,7 +120,6 @@ class BrowserifyTest < ActionController::IntegrationTest
|
|
120
120
|
|
121
121
|
assert_response :success
|
122
122
|
assert_equal expected_output, @response.body.strip
|
123
|
-
assert_equal true, @response.body.include?("ReMerY") # browserify internal global id for a_huge_library.js module
|
124
123
|
end
|
125
124
|
|
126
125
|
test "uses config/browserify.yml for browserification options" do
|
@@ -130,7 +129,6 @@ class BrowserifyTest < ActionController::IntegrationTest
|
|
130
129
|
|
131
130
|
assert_response :success
|
132
131
|
assert_equal expected_output, @response.body.strip
|
133
|
-
assert_equal true, @response.body.include?("ReMerY") # browserify internal global id for a_huge_library.js module
|
134
132
|
end
|
135
133
|
|
136
134
|
test "throws BrowserifyError if something went wrong while executing browserify" do
|
data/test/dummy/package.json
CHANGED
@@ -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);
|
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
|
|
@@ -9,4 +9,4 @@ module.exports = function (n) { return n * 11 }
|
|
9
9
|
},{"./nested":3}],3:[function(require,module,exports){
|
10
10
|
module.exports.NESTED = true;
|
11
11
|
|
12
|
-
},{}]},{},[1])
|
12
|
+
},{}]},{},[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);
|
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
|
|
4
4
|
},{"./foo":2}],2:[function(require,module,exports){
|
@@ -8,4 +8,4 @@ module.exports = function (n) { return n * 12 }
|
|
8
8
|
},{"./nested":3}],3:[function(require,module,exports){
|
9
9
|
module.exports.NESTED = true;
|
10
10
|
|
11
|
-
},{}]},{},[1])
|
11
|
+
},{}]},{},[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);
|
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
|
|
4
4
|
},{"./foo":2}],2:[function(require,module,exports){
|
@@ -8,4 +8,4 @@ module.exports = function (n) { return n * 11 }
|
|
8
8
|
},{"./nested":3}],3:[function(require,module,exports){
|
9
9
|
module.exports.NESTED = true;
|
10
10
|
|
11
|
-
},{}]},{},[1])
|
11
|
+
},{}]},{},[1]);
|
data/test/fixtures/foo.out.js
CHANGED
@@ -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);
|
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
|
require('./nested');
|
3
3
|
module.exports = function (n) { return n * 11 }
|
4
4
|
;
|
@@ -6,4 +6,4 @@ module.exports = function (n) { return n * 11 }
|
|
6
6
|
},{"./nested":2}],2:[function(require,module,exports){
|
7
7
|
module.exports.NESTED = true;
|
8
8
|
|
9
|
-
},{}]},{},[1])
|
9
|
+
},{}]},{},[1]);
|
data/test/fixtures/main.out.js
CHANGED
@@ -1,6 +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);
|
2
|
-
|
3
|
-
|
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
|
+
var library = require('./a_huge_library');
|
3
|
+
|
4
|
+
module.exports = function() {
|
5
|
+
console.log('library', library);
|
6
|
+
};
|
7
|
+
|
8
|
+
},{"./a_huge_library":2}],2:[function(require,module,exports){
|
4
9
|
// pretend this file is 1 MB
|
5
10
|
//
|
6
11
|
// app_main.js is going to require() it and browserify.yml is going to tell it to use --require on it
|
@@ -16,11 +21,4 @@ module.exports=require('ReMerY');
|
|
16
21
|
|
17
22
|
module.exports = "THIS IS A HUGE LIBRARY";
|
18
23
|
|
19
|
-
},{}],
|
20
|
-
var library = require('./a_huge_library');
|
21
|
-
|
22
|
-
module.exports = function() {
|
23
|
-
console.log('library', library);
|
24
|
-
};
|
25
|
-
|
26
|
-
},{"./a_huge_library":"ReMerY"}]},{},[3])
|
24
|
+
},{}]},{},[1]);
|
data/test/fixtures/mocha.js
CHANGED
@@ -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);
|
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
|
|
@@ -17,4 +17,4 @@ module.exports = function (n) { return n * 11 }
|
|
17
17
|
},{"./nested":3}],3:[function(require,module,exports){
|
18
18
|
module.exports.NESTED = true;
|
19
19
|
|
20
|
-
},{}]},{},[1])
|
20
|
+
},{}]},{},[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);
|
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);
|
@@ -6,4 +6,4 @@ console.log('answer', answer);
|
|
6
6
|
},{"some_folder/answer":2}],2:[function(require,module,exports){
|
7
7
|
module.exports = 42;
|
8
8
|
|
9
|
-
},{}]},{},[1])
|
9
|
+
},{}]},{},[1]);
|
@@ -1,8 +1,24 @@
|
|
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);
|
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":"
|
8
|
+
},{"./a_huge_library":"/a_huge_library"}],2:[function(require,module,exports){
|
9
|
+
// pretend this file is 1 MB
|
10
|
+
//
|
11
|
+
// app_main.js is going to require() it and browserify.yml is going to tell it to use --require on it
|
12
|
+
//
|
13
|
+
// app_secondary.js is going to require() it too but we know app_main.js is always going to be loaded
|
14
|
+
// so browserify.yml will be configured to mark it as --external so it is not bundled in
|
15
|
+
//
|
16
|
+
// this results in app_main.js taking the cost of loading app_a_huge_library.js
|
17
|
+
//
|
18
|
+
// and app_secondary.js saving the cost of loading app_a_huge_library.js (because again,
|
19
|
+
// we know a priori that something else has loaded it)
|
20
|
+
|
21
|
+
|
22
|
+
module.exports = "THIS IS A HUGE LIBRARY";
|
23
|
+
|
24
|
+
},{}]},{},[1]);
|
metadata
CHANGED
@@ -1,111 +1,111 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: browserify-rails
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.5.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: 2014-
|
11
|
+
date: 2014-10-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sprockets
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '2.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - ~>
|
24
|
+
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: bundler
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '1.3'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '1.3'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rails
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - ~>
|
59
|
+
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '3.2'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - ~>
|
66
|
+
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '3.2'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: coffee-rails
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- -
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: mocha
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
89
|
version: '0'
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
|
-
- -
|
94
|
+
- - ">="
|
95
95
|
- !ruby/object:Gem::Version
|
96
96
|
version: '0'
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: pry
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
-
- -
|
101
|
+
- - ">="
|
102
102
|
- !ruby/object:Gem::Version
|
103
103
|
version: '0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
|
-
- -
|
108
|
+
- - ">="
|
109
109
|
- !ruby/object:Gem::Version
|
110
110
|
version: '0'
|
111
111
|
description: Browserify + Rails = CommonJS Heaven
|
@@ -115,8 +115,8 @@ executables: []
|
|
115
115
|
extensions: []
|
116
116
|
extra_rdoc_files: []
|
117
117
|
files:
|
118
|
-
- .gitignore
|
119
|
-
- .travis.yml
|
118
|
+
- ".gitignore"
|
119
|
+
- ".travis.yml"
|
120
120
|
- Gemfile
|
121
121
|
- LICENSE.txt
|
122
122
|
- README.md
|
@@ -200,12 +200,12 @@ require_paths:
|
|
200
200
|
- lib
|
201
201
|
required_ruby_version: !ruby/object:Gem::Requirement
|
202
202
|
requirements:
|
203
|
-
- -
|
203
|
+
- - ">="
|
204
204
|
- !ruby/object:Gem::Version
|
205
205
|
version: '0'
|
206
206
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
207
207
|
requirements:
|
208
|
-
- -
|
208
|
+
- - ">="
|
209
209
|
- !ruby/object:Gem::Version
|
210
210
|
version: '0'
|
211
211
|
requirements: []
|