js_dependency 0.3.6 → 0.3.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/Gemfile.lock +1 -1
- data/lib/js_dependency/source_analysis/orphan.rb +27 -5
- data/lib/js_dependency/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: eed9f17f75fff9405d112f14ac2cccffffa9ecce728c718ff9a14eda3396c5ba
|
4
|
+
data.tar.gz: 645a8b5ab4363e2d1c4d7f6b25c79c0908d3f4a8ed78a928590c8d25e841c0e4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2b1160dfd6319369750cf8d10feffd4b703aa72ba1d0199e5e1e9bb341316beda0a07e7982f83675435e9642edd29fd999d5953c32c5f90aa95b2b81322f8ed8
|
7
|
+
data.tar.gz: ff0eb122ee309e0ba743c5c422e6ff21641e04131d5ec3da650781ec2e22f6878cbeaf2e006e03fc68dd170d64b80ca5d91471fa3259d4b4384bb67d9853782a
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
@@ -30,11 +30,9 @@ module JsDependency
|
|
30
30
|
# @param [String] target_path
|
31
31
|
# @return [TrueClass, FalseClass]
|
32
32
|
def orphan?(target_path)
|
33
|
-
|
34
|
-
paths
|
35
|
-
|
36
|
-
paths << parent_path
|
37
|
-
end
|
33
|
+
paths = parent_paths(target_path)
|
34
|
+
paths += dir_parent_paths(target_path) if target_path.include?("index.js")
|
35
|
+
|
38
36
|
paths.size.zero?
|
39
37
|
end
|
40
38
|
|
@@ -44,6 +42,30 @@ module JsDependency
|
|
44
42
|
def relative_path_or_external_path(path, src_path)
|
45
43
|
JsDependency::PathnameUtility.relative_path_or_external_path(path, src_path)
|
46
44
|
end
|
45
|
+
|
46
|
+
# Parent paths.
|
47
|
+
# @param [String] target_path
|
48
|
+
# @return [Array<String>]
|
49
|
+
def parent_paths(target_path)
|
50
|
+
target_pathname = JsDependency::TargetPathname.new(target_path)
|
51
|
+
paths = []
|
52
|
+
target_pathname.each_parent_path(1, @index) do |parent_path, _child_path|
|
53
|
+
paths << parent_path
|
54
|
+
end
|
55
|
+
paths
|
56
|
+
end
|
57
|
+
|
58
|
+
# Directory parent paths.
|
59
|
+
# @param [String] target_path
|
60
|
+
# @return [Array<String>]
|
61
|
+
def dir_parent_paths(target_path)
|
62
|
+
paths = []
|
63
|
+
target_pathname_dir = JsDependency::TargetPathname.new(Pathname.new(target_path).dirname.to_s)
|
64
|
+
target_pathname_dir.each_parent_path(1, @index) do |parent_path, _child_path|
|
65
|
+
paths << parent_path
|
66
|
+
end
|
67
|
+
paths
|
68
|
+
end
|
47
69
|
end
|
48
70
|
end
|
49
71
|
end
|