sprockets-iife 1.1.1 → 1.1.2
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/lib/sprockets-iife/item_processor.rb +3 -1
- data/lib/sprockets-iife/version.rb +1 -1
- data/test/fixtures/javascripts/nestedbundle.js +1 -0
- data/test/fixtures/javascripts/nestedbundle/bar-iife.js.erb +3 -0
- data/test/fixtures/javascripts/nestedbundle/bar.js +1 -0
- data/test/fixtures/javascripts/nestedbundle/baz.js +1 -0
- data/test/fixtures/javascripts/nestedbundle/foo-iife.js.erb +3 -0
- data/test/fixtures/javascripts/nestedbundle/foo.js +4 -0
- data/test/test-sprockets-iife.rb +10 -1
- metadata +13 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fa6d86c40744ba401d8685d61a89f96c63cb047c
|
4
|
+
data.tar.gz: 00e6918702988d4ad00c422429a0e01f53786be0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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
|
65
|
+
script_context.environment[ URI(uri).path ]
|
64
66
|
end
|
65
67
|
end
|
66
68
|
|
@@ -0,0 +1 @@
|
|
1
|
+
// =require nestedbundle/foo
|
@@ -0,0 +1 @@
|
|
1
|
+
bar.js();
|
@@ -0,0 +1 @@
|
|
1
|
+
baz.js();
|
data/test/test-sprockets-iife.rb
CHANGED
@@ -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.
|
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
|