sprockets-commoner 0.4.0 → 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/CHANGELOG.md +5 -0
- data/js/babel-plugin-sprockets-commoner-internal/index.js +0 -9
- data/lib/sprockets/commoner/processor.rb +14 -5
- data/lib/sprockets/commoner/version.rb +1 -1
- metadata +3 -6
- data/js/babel-plugin-sprockets-commoner/README.md +0 -3
- data/js/babel-plugin-sprockets-commoner/index.js +0 -7
- data/js/babel-plugin-sprockets-commoner/package.json +0 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0f24331ebf173f8083c0c49307c5b4ff3421a5f9
|
4
|
+
data.tar.gz: 7462509ec68a31116ce04f7977a607557b66d3c7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 00df5b32888954876a2f0f8ad15bbda01728d84780af38787426863238074d1f367107dcb9c5272bb60ed3c1cd563c4c52883ec593a2bcaed9ff3bef215c264f
|
7
|
+
data.tar.gz: 15ffc7f2426585ef5ad78f89cb3f4cc30ec48acd99bde3ab5639226883c66928fc2a749d8fb68650bdc61f42c7408e5459fcc39da1d46f09a26b6b1a88562788
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
+
## v0.5.0
|
4
|
+
|
5
|
+
* Added (currently undocumented) `transform_options` argument to `Processor`.
|
6
|
+
* Removed undocumented babelrc configuration method.
|
7
|
+
|
3
8
|
## v0.4.0
|
4
9
|
|
5
10
|
* Added `Sprockets::Commoner::Processor.unregister` method to remove the processor.
|
@@ -254,15 +254,6 @@ module.exports = function (context) {
|
|
254
254
|
extensions: ['.js', '.json', '.coffee', '.js.erb', '.coffee.erb']
|
255
255
|
};
|
256
256
|
|
257
|
-
// Look for the sprockets-commoner plugin for extra options
|
258
|
-
state.file.opts.plugins.map(function (plugin) {
|
259
|
-
return plugin[1];
|
260
|
-
}).filter(function (opts) {
|
261
|
-
return opts != null && opts.__commoner_options;
|
262
|
-
}).forEach(function (plugin) {
|
263
|
-
return Object.assign(opts, plugin);
|
264
|
-
});
|
265
|
-
|
266
257
|
Object.assign(opts, state.opts, { basedir: dirname(state.file.opts.filename) });
|
267
258
|
rootRegex = new RegExp('^' + state.file.opts.sourceRoot + '/');
|
268
259
|
identifierRegex = createIdentifierRegex();
|
@@ -60,12 +60,13 @@ module Sprockets
|
|
60
60
|
env.register_postprocessor('application/javascript', self.new(env.root, *args, **kwargs))
|
61
61
|
end
|
62
62
|
|
63
|
-
attr_reader :include, :exclude, :babel_exclude
|
64
|
-
def initialize(root, include: [root], exclude: ['vendor/bundle'], babel_exclude: [/node_modules/])
|
63
|
+
attr_reader :include, :exclude, :babel_exclude, :transform_options
|
64
|
+
def initialize(root, include: [root], exclude: ['vendor/bundle'], babel_exclude: [/node_modules/], transform_options: [])
|
65
65
|
@root = root
|
66
66
|
@include = include.map {|path| expand_to_root(path, root) }
|
67
67
|
@exclude = exclude.map {|path| expand_to_root(path, root) }
|
68
68
|
@babel_exclude = babel_exclude.map {|path| expand_to_root(path, root) }
|
69
|
+
@transform_options = transform_options.map {|(path, options)| [expand_to_root(path, root), options]}
|
69
70
|
super(root, 'NODE_PATH' => JS_PACKAGE_PATH)
|
70
71
|
end
|
71
72
|
|
@@ -83,10 +84,8 @@ module Sprockets
|
|
83
84
|
insertion_index = @required.index(input[:uri]) || -1
|
84
85
|
@dependencies = Set.new(input[:metadata][:dependencies])
|
85
86
|
|
86
|
-
|
87
87
|
babel_config = babelrc_data(filename)
|
88
|
-
|
89
|
-
result = transform(input[:data], options(input), paths: @env.paths)
|
88
|
+
result = transform(input[:data], options(input), commoner_options(input))
|
90
89
|
|
91
90
|
if result['metadata'].has_key?('targetsToProcess')
|
92
91
|
result['metadata']['targetsToProcess'].each do |t|
|
@@ -126,6 +125,7 @@ module Sprockets
|
|
126
125
|
@include.map(&:to_s),
|
127
126
|
@exclude.map(&:to_s),
|
128
127
|
@babel_exclude.map(&:to_s),
|
128
|
+
@transform_options.map { |(pattern, opts)| [pattern.to_s, opts] },
|
129
129
|
]
|
130
130
|
end
|
131
131
|
|
@@ -183,6 +183,15 @@ module Sprockets
|
|
183
183
|
return nil
|
184
184
|
end
|
185
185
|
|
186
|
+
def commoner_options(input)
|
187
|
+
options = {}
|
188
|
+
transform_options.each do |(path, opts)|
|
189
|
+
options.merge!(opts) if pattern_match(path, input[:filename])
|
190
|
+
end
|
191
|
+
options[:paths] = @env.paths
|
192
|
+
options
|
193
|
+
end
|
194
|
+
|
186
195
|
def options(input)
|
187
196
|
# TODO(bouk): Fix sourcemaps. Sourcemaps are only available in Sprockets v4
|
188
197
|
{
|
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.
|
4
|
+
version: 0.5.0
|
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-
|
11
|
+
date: 2016-07-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sprockets
|
@@ -153,9 +153,6 @@ files:
|
|
153
153
|
- js/babel-plugin-sprockets-commoner-internal/node_modules/resolve/lib/sync.js
|
154
154
|
- js/babel-plugin-sprockets-commoner-internal/node_modules/resolve/package.json
|
155
155
|
- js/babel-plugin-sprockets-commoner-internal/package.json
|
156
|
-
- js/babel-plugin-sprockets-commoner/README.md
|
157
|
-
- js/babel-plugin-sprockets-commoner/index.js
|
158
|
-
- js/babel-plugin-sprockets-commoner/package.json
|
159
156
|
- lib/sprockets/commoner.rb
|
160
157
|
- lib/sprockets/commoner/bundle.rb
|
161
158
|
- lib/sprockets/commoner/json_processor.rb
|
@@ -184,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
184
181
|
version: '0'
|
185
182
|
requirements: []
|
186
183
|
rubyforge_project:
|
187
|
-
rubygems_version: 2.5.1
|
184
|
+
rubygems_version: 2.4.5.1
|
188
185
|
signing_key:
|
189
186
|
specification_version: 4
|
190
187
|
summary: Use Babel in Sprockets to compile modules for the browser
|