sprockets-commoner 0.2.7 → 0.2.8

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: a1e62ad093fcb14cffdb8de7abc1a5f637613822
4
- data.tar.gz: cb4a64f339c34124b785a962007b02736639977d
3
+ metadata.gz: 4a2a4e5d2440a8ed522f71f4d7bcfd23e6a51b21
4
+ data.tar.gz: 935ba15297c44eb9b83bd00f829d185f5aa0363b
5
5
  SHA512:
6
- metadata.gz: a01cb7b802351bd9d9fbbf62b9fb8eb9c304fd41d28c44d7e2715b275acca484d51dfaa66f22d88f98be0caf1e13d36eaf6d69bb8794bf56ecd3dd53f4d27608
7
- data.tar.gz: b85696b4f98c9274e27124770c2f0dc6ac557008290d51d39b6a21859392f837a2d579a53870ba650347b436136e45c35a11e0dbd9ec686929636a2f4ba87785
6
+ metadata.gz: 09d56047331034979a9ca533aab2e1efb4ad8602b3fdb71d6e5c0031dbcbf610df9b1214045e4919de597c6b3ada7d6498ae5117e655ccd9540e8da12b2ad502
7
+ data.tar.gz: 8b215f95572d7073e9e3b4e5d238dca06f6b0cb04fcfd8ed912b026045e9d3b2d998487e42f17537dcc57bac16d37fc438042f3a3ad91405b9213a1b64f9b24c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Changelog
2
2
 
3
+ ## v0.2.8
4
+
5
+ * Modified the `cache_key` method of processor to not spin up a node process, but instead read the package.json directly.
6
+
3
7
  ## v0.2.7
4
8
 
5
9
  * Upgrade vendored `browser-resolve` to latest version to ensure compatibility with Node v6.
@@ -49,6 +49,7 @@ module Sprockets
49
49
 
50
50
  attr_reader :include, :exclude, :babel_exclude
51
51
  def initialize(root, include: [root], exclude: ['vendor/bundle'], babel_exclude: [/node_modules/])
52
+ @root = root
52
53
  @include = include.map {|path| expand_to_root(path, root) }
53
54
  @exclude = exclude.map {|path| expand_to_root(path, root) }
54
55
  @babel_exclude = babel_exclude.map {|path| expand_to_root(path, root) }
@@ -56,14 +57,7 @@ module Sprockets
56
57
  end
57
58
 
58
59
  def cache_key
59
- @cache_key ||= [
60
- self.class.name,
61
- VERSION,
62
- version,
63
- @include.map(&:to_s),
64
- @exclude.map(&:to_s),
65
- @babel_exclude.map(&:to_s),
66
- ]
60
+ @cache_key ||= compute_cache_key
67
61
  end
68
62
 
69
63
  def call(input)
@@ -107,6 +101,21 @@ module Sprockets
107
101
  end
108
102
 
109
103
  private
104
+ def compute_cache_key
105
+ package_file = File.join(@root, 'node_modules', 'babel-core', 'package.json')
106
+ raise Schmooze::DependencyError, 'Cannot determine babel version as babel-core has not been installed' unless File.exist?(package_file)
107
+ package = JSON.parse(File.read(package_file))
108
+
109
+ [
110
+ self.class.name,
111
+ VERSION,
112
+ package['version'],
113
+ @include.map(&:to_s),
114
+ @exclude.map(&:to_s),
115
+ @babel_exclude.map(&:to_s),
116
+ ]
117
+ end
118
+
110
119
  def expand_to_root(path, root)
111
120
  if path.is_a?(String)
112
121
  File.expand_path(path, root)
@@ -1,5 +1,5 @@
1
1
  module Sprockets
2
2
  module Commoner
3
- VERSION = '0.2.7'
3
+ VERSION = '0.2.8'
4
4
  end
5
5
  end
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.2.7
4
+ version: 0.2.8
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-06-13 00:00:00.000000000 Z
11
+ date: 2016-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sprockets