condenser 0.0.12 → 0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/condenser/asset.rb +1 -1
- data/lib/condenser/build_cache.rb +47 -24
- data/lib/condenser/environment.rb +0 -6
- data/lib/condenser/processors/node_modules/@types/estree/LICENSE +21 -21
- data/lib/condenser/processors/node_modules/@types/estree/README.md +16 -16
- data/lib/condenser/processors/node_modules/@types/node/LICENSE +21 -21
- data/lib/condenser/processors/node_modules/@types/node/README.md +16 -16
- data/lib/condenser/processors/node_modules/@types/resolve/README.md +16 -16
- data/lib/condenser/processors/node_modules/babel-plugin-transform-class-extended-hook/test/index.js +107 -107
- data/lib/condenser/processors/node_modules/color-name/.npmignore +106 -106
- data/lib/condenser/processors/node_modules/color-name/LICENSE +7 -7
- data/lib/condenser/processors/node_modules/color-name/README.md +11 -11
- data/lib/condenser/processors/node_modules/color-name/index.js +152 -152
- data/lib/condenser/processors/node_modules/color-name/test.js +7 -7
- data/lib/condenser/processors/node_modules/is-reference/node_modules/@types/estree/LICENSE +21 -21
- data/lib/condenser/processors/node_modules/is-reference/node_modules/@types/estree/README.md +16 -16
- data/lib/condenser/processors/node_modules/is-reference/node_modules/@types/estree/index.d.ts +548 -548
- data/lib/condenser/resolve.rb +12 -8
- data/lib/condenser/version.rb +1 -1
- data/test/cache_test.rb +16 -0
- data/test/test_helper.rb +5 -1
- metadata +2 -2
data/lib/condenser/resolve.rb
CHANGED
@@ -9,7 +9,7 @@ class Condenser
|
|
9
9
|
|
10
10
|
def build_cache
|
11
11
|
return @build_cache if instance_variable_defined?(:@build_cache)
|
12
|
-
@build_cache = BuildCache.new(path)
|
12
|
+
@build_cache = BuildCache.new(path, logger: logger)
|
13
13
|
end
|
14
14
|
|
15
15
|
def resolve(filename, base=nil, accept: nil)
|
@@ -20,7 +20,6 @@ class Condenser
|
|
20
20
|
|
21
21
|
cache_key = [dirname, basename].flatten.join('/')
|
22
22
|
cache_key << "@#{accept.join(',')}" if accept
|
23
|
-
|
24
23
|
build_cache.fetch(cache_key) do
|
25
24
|
build do
|
26
25
|
results = []
|
@@ -52,7 +51,7 @@ class Condenser
|
|
52
51
|
asset_dir = f_dirname.delete_prefix(path).delete_prefix('/')
|
53
52
|
asset_basename = f_basename + f_extensions.join('')
|
54
53
|
asset_filename = asset_dir.empty? ? asset_basename : File.join(asset_dir, asset_basename)
|
55
|
-
results << build_cache.map(asset_filename
|
54
|
+
results << build_cache.map("#{asset_filename}@#{f_mime_types.join('')}") do
|
56
55
|
Asset.new(self, {
|
57
56
|
filename: asset_filename,
|
58
57
|
content_types: f_mime_types,
|
@@ -66,7 +65,7 @@ class Condenser
|
|
66
65
|
asset_dir = f_dirname.delete_prefix(path).delete_prefix('/')
|
67
66
|
asset_basename = f_basename + derivative_mime_types.map { |t| @mime_types[t][:extensions].first }.join('')
|
68
67
|
asset_filename = asset_dir.empty? ? asset_basename : File.join(asset_dir, asset_basename)
|
69
|
-
results << build_cache.map(asset_filename
|
68
|
+
results << build_cache.map("#{asset_filename}@#{derivative_mime_types.join('')}") do
|
70
69
|
Asset.new(self, {
|
71
70
|
filename: asset_filename,
|
72
71
|
content_types: derivative_mime_types,
|
@@ -133,15 +132,20 @@ class Condenser
|
|
133
132
|
end
|
134
133
|
|
135
134
|
def build
|
136
|
-
|
137
|
-
|
138
|
-
|
135
|
+
if build_cache.listening && !build_cache.semaphore.owned?
|
136
|
+
build_cache.semaphore.lock
|
137
|
+
logger.debug { "build cache semaphore locked by #{Thread.current.object_id}" }
|
139
138
|
end
|
139
|
+
|
140
|
+
@build_cc += 1
|
140
141
|
yield
|
141
142
|
ensure
|
142
143
|
@build_cc -= 1
|
143
144
|
if @build_cc == 0
|
144
|
-
build_cache.
|
145
|
+
if build_cache.listening && build_cache.semaphore.owned?
|
146
|
+
logger.debug { "build cache semaphore unlocked by #{Thread.current.object_id}" }
|
147
|
+
build_cache.semaphore.unlock
|
148
|
+
end
|
145
149
|
end
|
146
150
|
end
|
147
151
|
|
data/lib/condenser/version.rb
CHANGED
data/test/cache_test.rb
CHANGED
@@ -188,4 +188,20 @@ class CacheTest < ActiveSupport::TestCase
|
|
188
188
|
CSS
|
189
189
|
end
|
190
190
|
|
191
|
+
test 'a dependency is removed for a glob call when one of it dependencies is delted' do
|
192
|
+
file "css/a.scss", "body { color: blue; }"
|
193
|
+
file "css/b.scss", "body { color: green; }"
|
194
|
+
file 'test.scss', '@import "css/*"'
|
195
|
+
|
196
|
+
assert_exported_file 'test.css', 'text/css', <<~CSS
|
197
|
+
body{color:blue}body{color:green}
|
198
|
+
CSS
|
199
|
+
|
200
|
+
rm "css/b.scss"
|
201
|
+
|
202
|
+
assert_exported_file 'test.css', 'text/css', <<~CSS
|
203
|
+
body{color:blue}
|
204
|
+
CSS
|
205
|
+
end
|
206
|
+
|
191
207
|
end
|
data/test/test_helper.rb
CHANGED
@@ -31,7 +31,7 @@ class ActiveSupport::TestCase
|
|
31
31
|
|
32
32
|
def setup
|
33
33
|
@path = File.realpath(Dir.mktmpdir)
|
34
|
-
@env = Condenser.new(@path, logger: Logger.new('/dev/null'))
|
34
|
+
@env = Condenser.new(@path, logger: Logger.new('/dev/null', level: :debug))
|
35
35
|
@env.context_class.class_eval do
|
36
36
|
def asset_path(path, options = {})
|
37
37
|
"/assets/#{path}"
|
@@ -59,6 +59,10 @@ class ActiveSupport::TestCase
|
|
59
59
|
File.write(path, source)
|
60
60
|
end
|
61
61
|
|
62
|
+
def rm(name)
|
63
|
+
File.delete(File.join(@path, name))
|
64
|
+
end
|
65
|
+
|
62
66
|
def assert_file(path, mime_types, source=nil)
|
63
67
|
sleep 0.25 if @env.build_cache.listening
|
64
68
|
asset = @env.find(path)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: condenser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: '0.1'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Bracy
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-01-
|
11
|
+
date: 2020-01-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: erubi
|