sprockets-iife 1.1.1 → 1.1.2

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: dc9c42d81e929c3447ccd9d074e7359dec690652
4
- data.tar.gz: 36c33c227d7493971368b18078ca0bd5f44c2da4
3
+ metadata.gz: fa6d86c40744ba401d8685d61a89f96c63cb047c
4
+ data.tar.gz: 00e6918702988d4ad00c422429a0e01f53786be0
5
5
  SHA512:
6
- metadata.gz: 1438e7d82e2a29efcfacb889e67b60efed30a4045734e407e131af506ac359ab8f034c518dc75956bc5acd1ca3f9d0355c85bcfb65dc196f85115f6dce3ffbe4
7
- data.tar.gz: c25d1c3bfff8429fe6254f50608308ff3840e52ec4807295b35d3de9956978dbab14913b8b1c30a9887167dc407f75f7227e1daa24e0b23275703c0a63289169
6
+ metadata.gz: 98bbe8eb7f30c6f3955816446b02fa813678e77dd32ca7dfd079d73eeca00f9e42e530727a48ae6c130fedecac4f6c9c68a8dad6a34e72789034cc299f834d4a
7
+ data.tar.gz: 26f3aea0392f172dcf77531fbf5b9cc6f03127ecfc88d738a80795ad388cf0ea0ed299269dd4340e11e4d96aaa33acb70adad5dda218c38fc5773871060b5e39
@@ -1,6 +1,8 @@
1
1
  # encoding: utf-8
2
2
  # frozen_string_literal: true
3
3
 
4
+ require 'uri'
5
+
4
6
  module SprocketsIIFE
5
7
  class ItemProcessor
6
8
  def initialize(script_path, &block)
@@ -60,7 +62,7 @@ module SprocketsIIFE
60
62
  script_source
61
63
  else
62
64
  # noinspection RubyResolve
63
- script_context.environment.load(uri)
65
+ script_context.environment[ URI(uri).path ]
64
66
  end
65
67
  end
66
68
 
@@ -2,5 +2,5 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  module SprocketsIIFE
5
- VERSION = '1.1.1'
5
+ VERSION = '1.1.2'
6
6
  end
@@ -0,0 +1 @@
1
+ // =require nestedbundle/foo
@@ -0,0 +1,3 @@
1
+ (function(/* bar-iife */) {
2
+ <%= source %>
3
+ }).call(this);
@@ -0,0 +1,3 @@
1
+ (function(/* foo-iife */) {
2
+ <%= source %>
3
+ }).call(this);
@@ -0,0 +1,4 @@
1
+ // =require ./bar
2
+ // =require ./baz
3
+
4
+ foo.js();
@@ -66,6 +66,15 @@ class SprocketsIIFETest < Test::Unit::TestCase
66
66
  }).call(this);
67
67
  JAVASCRIPT
68
68
  assert_equal expected, app.assets['mixedbundle.js'].to_s.squish
69
+
70
+ expected = <<-JAVASCRIPT.squish
71
+ (function(/* foo-iife */) {
72
+ (function(/* bar-iife */) { bar.js(); }).call(this);
73
+ baz.js();
74
+ foo.js();
75
+ }).call(this);
76
+ JAVASCRIPT
77
+ assert_equal expected, app.assets['nestedbundle.js'].to_s.squish
69
78
  end
70
79
 
71
80
  def setup
@@ -93,7 +102,7 @@ private
93
102
  config.assets.enabled = true
94
103
  config.assets.gzip = false
95
104
  config.assets.paths = [Rails.root.join('test/fixtures/javascripts').to_s]
96
- config.assets.precompile = %w( jsbundle.js coffeebundle.js mixedbundle.js )
105
+ config.assets.precompile = %w( jsbundle.js coffeebundle.js mixedbundle.js nestedbundle.js )
97
106
  config.paths['public'] = [Rails.root.join('tmp').to_s]
98
107
  config.active_support.deprecation = :stderr
99
108
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sprockets-iife
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yaroslav Konoplov
@@ -142,6 +142,12 @@ files:
142
142
  - test/fixtures/javascripts/mixedbundle/baz-iife.js.erb
143
143
  - test/fixtures/javascripts/mixedbundle/baz.js
144
144
  - test/fixtures/javascripts/mixedbundle/foo.js
145
+ - test/fixtures/javascripts/nestedbundle.js
146
+ - test/fixtures/javascripts/nestedbundle/bar-iife.js.erb
147
+ - test/fixtures/javascripts/nestedbundle/bar.js
148
+ - test/fixtures/javascripts/nestedbundle/baz.js
149
+ - test/fixtures/javascripts/nestedbundle/foo-iife.js.erb
150
+ - test/fixtures/javascripts/nestedbundle/foo.js
145
151
  - test/test-sprockets-iife.rb
146
152
  homepage: https://github.com/yivo/sprockets-iife
147
153
  licenses:
@@ -185,4 +191,10 @@ test_files:
185
191
  - test/fixtures/javascripts/mixedbundle/baz-iife.js.erb
186
192
  - test/fixtures/javascripts/mixedbundle/baz.js
187
193
  - test/fixtures/javascripts/mixedbundle/foo.js
194
+ - test/fixtures/javascripts/nestedbundle.js
195
+ - test/fixtures/javascripts/nestedbundle/bar-iife.js.erb
196
+ - test/fixtures/javascripts/nestedbundle/bar.js
197
+ - test/fixtures/javascripts/nestedbundle/baz.js
198
+ - test/fixtures/javascripts/nestedbundle/foo-iife.js.erb
199
+ - test/fixtures/javascripts/nestedbundle/foo.js
188
200
  - test/test-sprockets-iife.rb