sprockets-commoner 0.6.0 → 0.6.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b44e3e2485acd4eabd86a0f61663bc2efabd08d4
|
4
|
+
data.tar.gz: ab6bcbe414eda57988e9908eb2aeb8a5c82bc4fa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e513972c63f822bd3088135ff260d0f8433a35b66aafe078151d95f403567b5e804dd5cdf3e7f2289993aae405590fa26f07f9c2dbb3986ec0031ab13b44ad73
|
7
|
+
data.tar.gz: 460b3ae9a16c52436473a32b22dd874836963ad93701daaf6ea9592a72d94e731dd74109ab37a6da1b1fe6c35791d1c1786ae784437e1ee96758cb24e8e3142e
|
data/CHANGELOG.md
CHANGED
@@ -203,13 +203,17 @@ module.exports = function (context) {
|
|
203
203
|
if (file.metadata.targetsToProcess == null) {
|
204
204
|
file.metadata.targetsToProcess = [];
|
205
205
|
}
|
206
|
+
if (file.metadata.includedEnvironmentVariables == null) {
|
207
|
+
file.metadata.includedEnvironmentVariables = [];
|
208
|
+
}
|
206
209
|
},
|
207
210
|
|
208
211
|
visitor: {
|
209
|
-
MemberExpression: function MemberExpression(path) {
|
212
|
+
MemberExpression: function MemberExpression(path, state) {
|
210
213
|
if (path.get("object").matchesPattern("process.env")) {
|
211
214
|
var key = path.toComputedKey();
|
212
215
|
if (t.isStringLiteral(key)) {
|
216
|
+
state.file.metadata.includedEnvironmentVariables.push(key.value);
|
213
217
|
path.replaceWith(t.valueToNode(process.env[key.value]));
|
214
218
|
}
|
215
219
|
}
|
data/lib/sprockets/commoner.rb
CHANGED
@@ -13,6 +13,10 @@ module Sprockets
|
|
13
13
|
register_bundle_metadata_reducer 'application/javascript', :commoner_required, Set.new, :+
|
14
14
|
register_bundle_metadata_reducer 'application/javascript', :commoner_used_helpers, Set.new, :+
|
15
15
|
register_bundle_processor 'application/javascript', ::Sprockets::Commoner::Bundle
|
16
|
+
register_dependency_resolver 'commoner-environment-variable' do |env, str|
|
17
|
+
_, variable = str.split(':', 2)
|
18
|
+
ENV[variable]
|
19
|
+
end
|
16
20
|
end
|
17
21
|
|
18
22
|
require 'sprockets/commoner/railtie' if defined?(Rails)
|
@@ -7,7 +7,7 @@ module Sprockets
|
|
7
7
|
|
8
8
|
ExcludedFileError = Class.new(::StandardError)
|
9
9
|
|
10
|
-
VERSION = '
|
10
|
+
VERSION = '3'.freeze
|
11
11
|
BABELRC_FILE = '.babelrc'.freeze
|
12
12
|
PACKAGE_JSON = 'package.json'.freeze
|
13
13
|
JS_PACKAGE_PATH = File.expand_path('../../../js', __dir__)
|
@@ -100,6 +100,10 @@ module Sprockets
|
|
100
100
|
@required.insert(insertion_index, asset)
|
101
101
|
end
|
102
102
|
|
103
|
+
result['metadata']['includedEnvironmentVariables'].each do |env|
|
104
|
+
@dependencies << "commoner-environment-variable:#{env}"
|
105
|
+
end
|
106
|
+
|
103
107
|
{
|
104
108
|
data: result['code'],
|
105
109
|
dependencies: @dependencies,
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sprockets-commoner
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bouke van der Bijl
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-08-
|
11
|
+
date: 2016-08-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sprockets
|