browserify-rails 3.0.0 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/lib/browserify-rails/browserify_processor.rb +1 -1
- data/lib/browserify-rails/version.rb +1 -1
- data/test/compilation_test.rb +17 -0
- data/test/dummy/app/assets/javascripts/simple_module.js.example +3 -0
- data/test/dummy/app/assets/javascripts/use_import.js.example +3 -0
- data/test/dummy/package.json +7 -4
- data/test/fixtures/use_import.out.js +23 -0
- metadata +8 -2
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: cf502572f6275f391156cf2273f3a0f8b907a366
         | 
| 4 | 
            +
              data.tar.gz: 8befbde05169e6bb26cb29755f0fbd741728c28a
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: d68033290efa9969de781573a246c244db84ed3c1ad275863d75904b5dbcdeef0f705d1c30dec0fbdd83cbb4ddf9bcbf2b0ad6f52295a46951ec98516abb4394
         | 
| 7 | 
            +
              data.tar.gz: 87530c1f97cd9d2f07ccabb2e9619bece8e7c5c4a8d6f928facf52d34eaf00400f1cf960de09546235f4deae5c9da3c5c96519fbe963ace578f87264013bdb79
         | 
    
        data/CHANGELOG.md
    CHANGED
    
    
| @@ -112,7 +112,7 @@ module BrowserifyRails | |
| 112 112 | 
             
                # Be here as strict as possible, so that non-commonjs files are not
         | 
| 113 113 | 
             
                # preprocessed.
         | 
| 114 114 | 
             
                def commonjs_module?
         | 
| 115 | 
            -
                  data.to_s.include?("module.exports") || data.present? && data.to_s.match(/require\(.*\)/) && dependencies.length > 0
         | 
| 115 | 
            +
                  data.to_s.include?("module.exports") || data.present? && data.to_s.match(/(require\(.*\)|import)/) && dependencies.length > 0
         | 
| 116 116 | 
             
                end
         | 
| 117 117 |  | 
| 118 118 | 
             
                def asset_paths
         | 
    
        data/test/compilation_test.rb
    CHANGED
    
    | @@ -32,6 +32,8 @@ class BrowserifyTest < ActionDispatch::IntegrationTest | |
| 32 32 | 
             
                copy_example_file "some_folder/answer.js.example"
         | 
| 33 33 | 
             
                copy_example_file "browserified.js.example"
         | 
| 34 34 | 
             
                copy_example_file "index.js.example", "node_modules/node-test-package"
         | 
| 35 | 
            +
                copy_example_file "simple_module.js.example"
         | 
| 36 | 
            +
                copy_example_file "use_import.js.example"
         | 
| 35 37 | 
             
              end
         | 
| 36 38 |  | 
| 37 39 | 
             
              test "asset pipeline should serve application.js" do
         | 
| @@ -278,4 +280,19 @@ class BrowserifyTest < ActionDispatch::IntegrationTest | |
| 278 280 |  | 
| 279 281 | 
             
                assert_match /BrowserifyRails::BrowserifyError/, @response.body
         | 
| 280 282 | 
             
              end
         | 
| 283 | 
            +
             | 
| 284 | 
            +
              test "identifies files that call import function as modules" do
         | 
| 285 | 
            +
                Dummy::Application.config.browserify_rails.commandline_options = "-t [ babelify --presets [ es2015 ] ]"
         | 
| 286 | 
            +
             | 
| 287 | 
            +
                begin
         | 
| 288 | 
            +
                  expected_output = fixture("use_import.out.js")
         | 
| 289 | 
            +
             | 
| 290 | 
            +
                  get "/assets/use_import.js"
         | 
| 291 | 
            +
             | 
| 292 | 
            +
                  assert_response :success
         | 
| 293 | 
            +
                  assert_equal expected_output, @response.body.strip
         | 
| 294 | 
            +
                ensure
         | 
| 295 | 
            +
                  Dummy::Application.config.browserify_rails.commandline_options = ""
         | 
| 296 | 
            +
                end
         | 
| 297 | 
            +
              end
         | 
| 281 298 | 
             
            end
         | 
    
        data/test/dummy/package.json
    CHANGED
    
    | @@ -2,10 +2,13 @@ | |
| 2 2 | 
             
              "name": "dummy",
         | 
| 3 3 | 
             
              "author": "Henry Hsu <hhsu@zendesk.com>",
         | 
| 4 4 | 
             
              "description": "a dummy Rails application",
         | 
| 5 | 
            -
              "devDependencies" | 
| 6 | 
            -
                " | 
| 7 | 
            -
                " | 
| 8 | 
            -
                " | 
| 5 | 
            +
              "devDependencies": {
         | 
| 6 | 
            +
                "babel": "6.3.26",
         | 
| 7 | 
            +
                "babel-preset-es2015": "^6.6.0",
         | 
| 8 | 
            +
                "babelify": "7.2.0",
         | 
| 9 | 
            +
                "browserify": "6.3.4",
         | 
| 10 | 
            +
                "browserify-incremental": "3.0.1",
         | 
| 11 | 
            +
                "coffeeify": "2.0.1",
         | 
| 9 12 | 
             
                "exorcist": "~> 0.3.0",
         | 
| 10 13 | 
             
                "node-test-package": "~> 0.0.2"
         | 
| 11 14 | 
             
              },
         | 
| @@ -0,0 +1,23 @@ | |
| 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/cymen/dev/browserify-rails/test/dummy/app/assets/javascripts/_stream_0.js":[function(require,module,exports){
         | 
| 2 | 
            +
            'use strict';
         | 
| 3 | 
            +
             | 
| 4 | 
            +
            var _simple_module = require('./simple_module');
         | 
| 5 | 
            +
             | 
| 6 | 
            +
            var _simple_module2 = _interopRequireDefault(_simple_module);
         | 
| 7 | 
            +
             | 
| 8 | 
            +
            function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
         | 
| 9 | 
            +
             | 
| 10 | 
            +
            console.log((0, _simple_module2.default)());
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            },{"./simple_module":"/Users/cymen/dev/browserify-rails/test/dummy/app/assets/javascripts/simple_module.js"}],"/Users/cymen/dev/browserify-rails/test/dummy/app/assets/javascripts/simple_module.js":[function(require,module,exports){
         | 
| 13 | 
            +
            "use strict";
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            Object.defineProperty(exports, "__esModule", {
         | 
| 16 | 
            +
              value: true
         | 
| 17 | 
            +
            });
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            exports.default = function () {
         | 
| 20 | 
            +
              return 42;
         | 
| 21 | 
            +
            };
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            },{}]},{},["/Users/cymen/dev/browserify-rails/test/dummy/app/assets/javascripts/_stream_0.js"]);
         | 
    
        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.0. | 
| 4 | 
            +
              version: 3.0.1
         | 
| 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- | 
| 11 | 
            +
            date: 2016-03-03 00:00:00.000000000 Z
         | 
| 12 12 | 
             
            dependencies:
         | 
| 13 13 | 
             
            - !ruby/object:Gem::Dependency
         | 
| 14 14 | 
             
              name: railties
         | 
| @@ -182,7 +182,9 @@ files: | |
| 182 182 | 
             
            - test/dummy/app/assets/javascripts/plain.js
         | 
| 183 183 | 
             
            - test/dummy/app/assets/javascripts/require_in_a_comment.js.example
         | 
| 184 184 | 
             
            - test/dummy/app/assets/javascripts/secondary.js.example
         | 
| 185 | 
            +
            - test/dummy/app/assets/javascripts/simple_module.js.example
         | 
| 185 186 | 
             
            - test/dummy/app/assets/javascripts/some_folder/answer.js.example
         | 
| 187 | 
            +
            - test/dummy/app/assets/javascripts/use_import.js.example
         | 
| 186 188 | 
             
            - test/dummy/app/assets/stylesheets/application.css
         | 
| 187 189 | 
             
            - test/dummy/app/controllers/application_controller.rb
         | 
| 188 190 | 
             
            - test/dummy/app/controllers/home_controller.rb
         | 
| @@ -231,6 +233,7 @@ files: | |
| 231 233 | 
             
            - test/fixtures/plain.out.js
         | 
| 232 234 | 
             
            - test/fixtures/require_in_a_comment.js
         | 
| 233 235 | 
             
            - test/fixtures/secondary.out.js
         | 
| 236 | 
            +
            - test/fixtures/use_import.out.js
         | 
| 234 237 | 
             
            - test/test_helper.rb
         | 
| 235 238 | 
             
            homepage: https://github.com/browserify-rails/browserify-rails
         | 
| 236 239 | 
             
            licenses:
         | 
| @@ -276,7 +279,9 @@ test_files: | |
| 276 279 | 
             
            - test/dummy/app/assets/javascripts/plain.js
         | 
| 277 280 | 
             
            - test/dummy/app/assets/javascripts/require_in_a_comment.js.example
         | 
| 278 281 | 
             
            - test/dummy/app/assets/javascripts/secondary.js.example
         | 
| 282 | 
            +
            - test/dummy/app/assets/javascripts/simple_module.js.example
         | 
| 279 283 | 
             
            - test/dummy/app/assets/javascripts/some_folder/answer.js.example
         | 
| 284 | 
            +
            - test/dummy/app/assets/javascripts/use_import.js.example
         | 
| 280 285 | 
             
            - test/dummy/app/assets/stylesheets/application.css
         | 
| 281 286 | 
             
            - test/dummy/app/controllers/application_controller.rb
         | 
| 282 287 | 
             
            - test/dummy/app/controllers/home_controller.rb
         | 
| @@ -325,4 +330,5 @@ test_files: | |
| 325 330 | 
             
            - test/fixtures/plain.out.js
         | 
| 326 331 | 
             
            - test/fixtures/require_in_a_comment.js
         | 
| 327 332 | 
             
            - test/fixtures/secondary.out.js
         | 
| 333 | 
            +
            - test/fixtures/use_import.out.js
         | 
| 328 334 | 
             
            - test/test_helper.rb
         |