js_dependency 0.3.15 → 0.4.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
  SHA256:
3
- metadata.gz: c40c515c695755869134ea2cda376981c48e4202648fc4946d66219b93d5917b
4
- data.tar.gz: c185eaf95efb2f6a8c11abd91380b2f736c8ddee5dc410f7ea0dab44641eb0aa
3
+ metadata.gz: b6012cddd2cb701448c1243a3b7cf444bc144852935460b00e3065518451c7ee
4
+ data.tar.gz: 9d5a37df572c77dae170431eb38d81133b0877a6d10a47492c5062579613a106
5
5
  SHA512:
6
- metadata.gz: af9562638595533ae8cda360e0a5575909a3d36f376e47d863988b0e2ced296853cafda54468530c8484c63516d304ce8e7180e7491491461748778df340eb06
7
- data.tar.gz: f2f0046905e4906585b47b89b50d37e767b96498d49680202346105ac78f07322cb4eb69471611e326031d654c37e6bb3ef4d37c72d7b1e29c8f4a45220d106b
6
+ metadata.gz: 811ffb4340bb7b26ae1c19a51c369d052a032175bc655f194fa51c687167659b159ce877706532ad329bccc835b300cb007123a4c3864b81bc8625375b40471c
7
+ data.tar.gz: 73c92c3b0ecfdb9b2885810532f0d5556aac5881ee4e82429e01c712acee1ab56ea5d5459c3438909e168310d129ece31264cff29fb5f5618504554fa6f2e179
data/CHANGELOG.md CHANGED
@@ -1,5 +1,18 @@
1
1
  ## [Unreleased]
2
2
 
3
+ ## [0.4.1] - 2024-04-01
4
+
5
+ - Add support ts and tsx file. [#38](https://github.com/junara/js_dependency/pull/38)
6
+
7
+ ## [0.4.0] - 2024-03-31
8
+
9
+ - Breaking change: Support only Ruby 3.0 or later. [#34](https://github.com/junara/js_dependency/pull/34)
10
+
11
+ - Add support Vue script setup and lang. [#35](https://github.com/junara/js_dependency/pull/35) [#36](https://github.com/junara/js_dependency/pull/36)
12
+ - `<script setup>` and `<script lang="ts">` are supported.
13
+
14
+ - Fix some typos. [#33](https://github.com/junara/js_dependency/pull/33)
15
+
3
16
  ## [0.3.15] - 2022-08-21
4
17
 
5
18
  - Add exclude_output_names option for export_markdown_report.
@@ -31,7 +44,7 @@
31
44
 
32
45
  ## [0.3.8] - 2022-08-11
33
46
 
34
- - `.js_dependecy.yaml` is arrowed for configuration file name.
47
+ - `.js_dependency.yaml` is arrowed for configuration file name.
35
48
  - Refactor codes.
36
49
  - Add test codes.
37
50
 
data/Gemfile CHANGED
@@ -11,6 +11,15 @@ gem "rspec", "~> 3.0"
11
11
 
12
12
  gem "codecov", require: false, group: "test"
13
13
  gem "debug", ">= 1.0.0"
14
+ gem "guard-rspec", require: false
14
15
  gem "rubocop", "~> 1.21"
15
16
  gem "simplecov", require: false, group: :test
16
17
  gem "yarn"
18
+
19
+ gem "rspec-parameterized", "~> 1.0"
20
+
21
+ gem "rubocop-performance", "~> 1.21"
22
+
23
+ gem "rubocop-rake", "~> 0.6.0"
24
+
25
+ gem "rubocop-rspec", "~> 2.28"
data/Gemfile.lock CHANGED
@@ -1,8 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- js_dependency (0.3.15)
5
- pathname
4
+ js_dependency (0.4.1)
6
5
  thor
7
6
  yaml
8
7
 
@@ -10,87 +9,144 @@ GEM
10
9
  remote: https://rubygems.org/
11
10
  specs:
12
11
  ast (2.4.2)
13
- binding_ninja (0.2.3)
12
+ binding_of_caller (1.0.1)
13
+ debug_inspector (>= 1.2.0)
14
14
  codecov (0.6.0)
15
15
  simplecov (>= 0.15, < 0.22)
16
16
  coderay (1.1.3)
17
- debug (1.6.2)
18
- irb (>= 1.3.6)
19
- reline (>= 0.3.1)
20
- diff-lcs (1.5.0)
17
+ debug (1.9.2)
18
+ irb (~> 1.10)
19
+ reline (>= 0.3.8)
20
+ debug_inspector (1.2.0)
21
+ diff-lcs (1.5.1)
21
22
  docile (1.4.0)
22
- io-console (0.5.11)
23
- irb (1.4.1)
24
- reline (>= 0.3.0)
25
- json (2.6.2)
26
- parallel (1.22.1)
27
- parser (3.1.2.1)
23
+ ffi (1.16.3)
24
+ formatador (1.1.0)
25
+ guard (2.18.1)
26
+ formatador (>= 0.2.4)
27
+ listen (>= 2.7, < 4.0)
28
+ lumberjack (>= 1.0.12, < 2.0)
29
+ nenv (~> 0.1)
30
+ notiffany (~> 0.0)
31
+ pry (>= 0.13.0)
32
+ shellany (~> 0.0)
33
+ thor (>= 0.18.1)
34
+ guard-compat (1.2.1)
35
+ guard-rspec (4.7.3)
36
+ guard (~> 2.1)
37
+ guard-compat (~> 1.1)
38
+ rspec (>= 2.99.0, < 4.0)
39
+ io-console (0.7.2)
40
+ irb (1.12.0)
41
+ rdoc
42
+ reline (>= 0.4.2)
43
+ json (2.7.1)
44
+ language_server-protocol (3.17.0.3)
45
+ listen (3.9.0)
46
+ rb-fsevent (~> 0.10, >= 0.10.3)
47
+ rb-inotify (~> 0.9, >= 0.9.10)
48
+ lumberjack (1.2.10)
49
+ method_source (1.0.0)
50
+ nenv (0.3.0)
51
+ notiffany (0.1.3)
52
+ nenv (~> 0.1)
53
+ shellany (~> 0.0)
54
+ parallel (1.24.0)
55
+ parser (3.3.0.5)
28
56
  ast (~> 2.4.1)
57
+ racc
29
58
  parslet (2.0.0)
30
- pathname (0.2.0)
31
59
  proc_to_ast (0.1.0)
32
60
  coderay
33
61
  parser
34
62
  unparser
35
- rack (2.2.4)
63
+ pry (0.14.2)
64
+ coderay (~> 1.1)
65
+ method_source (~> 1.0)
66
+ psych (5.1.2)
67
+ stringio
68
+ racc (1.7.3)
69
+ rack (3.0.10)
36
70
  rainbow (3.1.1)
37
- rake (13.0.6)
38
- regexp_parser (2.5.0)
39
- reline (0.3.1)
71
+ rake (13.1.0)
72
+ rb-fsevent (0.11.2)
73
+ rb-inotify (0.10.1)
74
+ ffi (~> 1.0)
75
+ rdoc (6.6.3.1)
76
+ psych (>= 4.0.0)
77
+ regexp_parser (2.9.0)
78
+ reline (0.5.0)
40
79
  io-console (~> 0.5)
41
- rexml (3.2.5)
42
- rspec (3.11.0)
43
- rspec-core (~> 3.11.0)
44
- rspec-expectations (~> 3.11.0)
45
- rspec-mocks (~> 3.11.0)
46
- rspec-core (3.11.0)
47
- rspec-support (~> 3.11.0)
48
- rspec-expectations (3.11.0)
80
+ rexml (3.2.6)
81
+ rspec (3.13.0)
82
+ rspec-core (~> 3.13.0)
83
+ rspec-expectations (~> 3.13.0)
84
+ rspec-mocks (~> 3.13.0)
85
+ rspec-core (3.13.0)
86
+ rspec-support (~> 3.13.0)
87
+ rspec-expectations (3.13.0)
49
88
  diff-lcs (>= 1.2.0, < 2.0)
50
- rspec-support (~> 3.11.0)
51
- rspec-mocks (3.11.1)
89
+ rspec-support (~> 3.13.0)
90
+ rspec-mocks (3.13.0)
52
91
  diff-lcs (>= 1.2.0, < 2.0)
53
- rspec-support (~> 3.11.0)
54
- rspec-parameterized (0.5.2)
55
- binding_ninja (>= 0.2.3)
92
+ rspec-support (~> 3.13.0)
93
+ rspec-parameterized (1.0.0)
94
+ rspec-parameterized-core (< 2)
95
+ rspec-parameterized-table_syntax (< 2)
96
+ rspec-parameterized-core (1.0.0)
56
97
  parser
57
98
  proc_to_ast
58
99
  rspec (>= 2.13, < 4)
59
100
  unparser
60
- rspec-support (3.11.0)
61
- rubocop (1.35.0)
101
+ rspec-parameterized-table_syntax (1.0.1)
102
+ binding_of_caller
103
+ rspec-parameterized-core (< 2)
104
+ rspec-support (3.13.1)
105
+ rubocop (1.62.1)
62
106
  json (~> 2.3)
107
+ language_server-protocol (>= 3.17.0)
63
108
  parallel (~> 1.10)
64
- parser (>= 3.1.2.1)
109
+ parser (>= 3.3.0.2)
65
110
  rainbow (>= 2.2.2, < 4.0)
66
111
  regexp_parser (>= 1.8, < 3.0)
67
112
  rexml (>= 3.2.5, < 4.0)
68
- rubocop-ast (>= 1.20.1, < 2.0)
113
+ rubocop-ast (>= 1.31.1, < 2.0)
69
114
  ruby-progressbar (~> 1.7)
70
- unicode-display_width (>= 1.4.0, < 3.0)
71
- rubocop-ast (1.21.0)
72
- parser (>= 3.1.1.0)
73
- rubocop-performance (1.14.3)
74
- rubocop (>= 1.7.0, < 2.0)
75
- rubocop-ast (>= 0.4.0)
115
+ unicode-display_width (>= 2.4.0, < 3.0)
116
+ rubocop-ast (1.31.2)
117
+ parser (>= 3.3.0.4)
118
+ rubocop-capybara (2.20.0)
119
+ rubocop (~> 1.41)
120
+ rubocop-factory_bot (2.25.1)
121
+ rubocop (~> 1.41)
122
+ rubocop-performance (1.21.0)
123
+ rubocop (>= 1.48.1, < 2.0)
124
+ rubocop-ast (>= 1.31.1, < 2.0)
76
125
  rubocop-rake (0.6.0)
77
126
  rubocop (~> 1.0)
78
- rubocop-rspec (2.12.1)
79
- rubocop (~> 1.31)
80
- ruby-progressbar (1.11.0)
127
+ rubocop-rspec (2.28.0)
128
+ rubocop (~> 1.40)
129
+ rubocop-capybara (~> 2.17)
130
+ rubocop-factory_bot (~> 2.22)
131
+ rubocop-rspec_rails (~> 2.28)
132
+ rubocop-rspec_rails (2.28.1)
133
+ rubocop (~> 1.40)
134
+ ruby-progressbar (1.13.0)
135
+ shellany (0.0.1)
81
136
  simplecov (0.21.2)
82
137
  docile (~> 1.1)
83
138
  simplecov-html (~> 0.11)
84
139
  simplecov_json_formatter (~> 0.1)
85
140
  simplecov-html (0.12.3)
86
141
  simplecov_json_formatter (0.1.4)
87
- thor (1.2.1)
142
+ stringio (3.1.0)
143
+ thor (1.3.1)
88
144
  trollop (2.9.10)
89
- unicode-display_width (2.2.0)
90
- unparser (0.6.5)
145
+ unicode-display_width (2.5.0)
146
+ unparser (0.6.13)
91
147
  diff-lcs (~> 1.3)
92
- parser (>= 3.1.0)
93
- yaml (0.2.0)
148
+ parser (>= 3.3.0)
149
+ yaml (0.3.0)
94
150
  yarn (0.1.1)
95
151
  parslet (>= 1.2)
96
152
  rack (>= 1.3)
@@ -98,21 +154,23 @@ GEM
98
154
 
99
155
  PLATFORMS
100
156
  arm64-darwin-21
157
+ arm64-darwin-23
101
158
  x86_64-linux
102
159
 
103
160
  DEPENDENCIES
104
161
  codecov
105
162
  debug (>= 1.0.0)
163
+ guard-rspec
106
164
  js_dependency!
107
165
  rake (~> 13.0)
108
166
  rspec (~> 3.0)
109
- rspec-parameterized
167
+ rspec-parameterized (~> 1.0)
110
168
  rubocop (~> 1.21)
111
- rubocop-performance
112
- rubocop-rake
113
- rubocop-rspec
169
+ rubocop-performance (~> 1.21)
170
+ rubocop-rake (~> 0.6.0)
171
+ rubocop-rspec (~> 2.28)
114
172
  simplecov
115
173
  yarn
116
174
 
117
175
  BUNDLED WITH
118
- 2.3.16
176
+ 2.5.3
data/Guardfile ADDED
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ guard :rspec, cmd: "bundle exec rspec" do
4
+ require "guard/rspec/dsl"
5
+ dsl = Guard::RSpec::Dsl.new(self)
6
+
7
+ # Feel free to open issues for suggestions and improvements
8
+
9
+ # RSpec files
10
+ rspec = dsl.rspec
11
+ watch(rspec.spec_helper) { rspec.spec_dir }
12
+ watch(rspec.spec_support) { rspec.spec_dir }
13
+ watch(rspec.spec_files)
14
+
15
+ # Ruby files
16
+ ruby = dsl.ruby
17
+ dsl.watch_spec_files_for(ruby.lib_files)
18
+ end
data/README.md CHANGED
@@ -212,6 +212,13 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run
212
212
 
213
213
  To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
214
214
 
215
+
216
+ ### Using guard-rspec
217
+
218
+ ```shell
219
+ bundle exec guard
220
+ ```
221
+
215
222
  ## Contributing
216
223
 
217
224
  Bug reports and pull requests are welcome on GitHub at https://github.com/junara/js_dependency. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/js_dependency/blob/main/CODE_OF_CONDUCT.md).
@@ -30,15 +30,8 @@ Gem::Specification.new do |spec|
30
30
  spec.executables = spec.files.grep(%r{\Aexe/}) { |f| File.basename(f) }
31
31
  spec.require_paths = ["lib"]
32
32
 
33
- spec.add_dependency "pathname"
34
33
  spec.add_dependency "thor"
35
34
  spec.add_dependency "yaml"
36
- spec.add_development_dependency "rspec"
37
- spec.add_development_dependency "rspec-parameterized"
38
- spec.add_development_dependency "rubocop"
39
- spec.add_development_dependency "rubocop-performance"
40
- spec.add_development_dependency "rubocop-rake"
41
- spec.add_development_dependency "rubocop-rspec"
42
35
 
43
36
  # For more information and examples about making a new gem, check out our
44
37
  # guide at: https://bundler.io/guides/creating_gem.html
@@ -87,7 +87,7 @@ module JsDependency
87
87
  return nil if obj.nil?
88
88
  return obj if obj.is_a?(String)
89
89
 
90
- return obj.first if obj.is_a?(Array)
90
+ obj.first if obj.is_a?(Array)
91
91
  end
92
92
  end
93
93
  end
@@ -15,7 +15,15 @@ module JsDependency
15
15
  list << Regexp.last_match(1)
16
16
  end
17
17
 
18
- scripts += str.gsub(%r{<script.+src=".+">(.+)</script>}m).with_object([]) do |_, list|
18
+ scripts += str.gsub(%r{<script.+src=["'].+["']>(.+)</script>}m).with_object([]) do |_, list|
19
+ list << Regexp.last_match(1)
20
+ end
21
+
22
+ scripts += str.gsub(%r{<script.+setup>(.+)</script>}m).with_object([]) do |_, list|
23
+ list << Regexp.last_match(1)
24
+ end
25
+
26
+ scripts += str.gsub(%r{<script.+lang=["'][tj]s["']>(.+)</script>}m).with_object([]) do |_, list|
19
27
  list << Regexp.last_match(1)
20
28
  end
21
29
 
@@ -42,14 +42,14 @@ module JsDependency
42
42
  # @param [Array<String>] alias_paths
43
43
  # @return [Hash]
44
44
  def index_from(src_pathname, alias_paths)
45
- pattern = %w[**/*.vue **/*.js **/*.jsx]
45
+ pattern = %w[**/*.vue **/*.js **/*.jsx **/*.ts **/*.tsx]
46
46
 
47
47
  src_pathname.glob(pattern).each_with_object({}) do |component_pathname, obj|
48
48
  import_pathnames = import_pathnames_from(component_pathname, alias_paths)
49
49
  import_pathnames += src_javascript_pathnames_from(component_pathname, alias_paths)
50
50
 
51
51
  obj[component_pathname.to_s] = import_pathnames.map(&:to_s)
52
- if component_pathname.basename.to_s == "index.js"
52
+ if component_pathname.basename.to_s == "index.js" || component_pathname.basename.to_s == "index.ts"
53
53
  obj[component_pathname.dirname.to_s] =
54
54
  import_pathnames.map(&:to_s)
55
55
  end
@@ -16,7 +16,7 @@ module JsDependency
16
16
 
17
17
  # @return [String]
18
18
  def export
19
- markdown = <<~"MAKRDOWNTEXT"
19
+ markdown = <<~MAKRDOWNTEXT
20
20
  ## JsDependency Reports
21
21
 
22
22
  ### Orphan modules
@@ -35,13 +35,13 @@ module JsDependency
35
35
  if @mermaid_markdown.nil? || @mermaid_markdown.empty?
36
36
  markdown += ".vue or .js or .jsx files are not changed.\n\n"
37
37
  else
38
- markdown += <<~"MAKRDOWNTEXT"
38
+ markdown += <<~MAKRDOWNTEXT
39
39
  ```mermaid
40
40
  MAKRDOWNTEXT
41
41
 
42
42
  markdown += @mermaid_markdown.to_s
43
43
 
44
- markdown += <<~"MAKRDOWNTEXT"
44
+ markdown += <<~MAKRDOWNTEXT
45
45
  ```
46
46
 
47
47
  MAKRDOWNTEXT
@@ -33,7 +33,7 @@ module JsDependency
33
33
  paths = parent_paths(target_path)
34
34
  paths += dir_parent_paths(target_path) if target_path.include?("index.js")
35
35
 
36
- paths.size.zero?
36
+ paths.empty?
37
37
  end
38
38
 
39
39
  # @param [String] path
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JsDependency
4
- VERSION = "0.3.15"
4
+ VERSION = "0.4.1"
5
5
  end
metadata CHANGED
@@ -1,29 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: js_dependency
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.15
4
+ version: 0.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - junara
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-08-21 00:00:00.000000000 Z
11
+ date: 2024-03-31 00:00:00.000000000 Z
12
12
  dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: pathname
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - ">="
18
- - !ruby/object:Gem::Version
19
- version: '0'
20
- type: :runtime
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - ">="
25
- - !ruby/object:Gem::Version
26
- version: '0'
27
13
  - !ruby/object:Gem::Dependency
28
14
  name: thor
29
15
  requirement: !ruby/object:Gem::Requirement
@@ -52,90 +38,6 @@ dependencies:
52
38
  - - ">="
53
39
  - !ruby/object:Gem::Version
54
40
  version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: rspec
57
- requirement: !ruby/object:Gem::Requirement
58
- requirements:
59
- - - ">="
60
- - !ruby/object:Gem::Version
61
- version: '0'
62
- type: :development
63
- prerelease: false
64
- version_requirements: !ruby/object:Gem::Requirement
65
- requirements:
66
- - - ">="
67
- - !ruby/object:Gem::Version
68
- version: '0'
69
- - !ruby/object:Gem::Dependency
70
- name: rspec-parameterized
71
- requirement: !ruby/object:Gem::Requirement
72
- requirements:
73
- - - ">="
74
- - !ruby/object:Gem::Version
75
- version: '0'
76
- type: :development
77
- prerelease: false
78
- version_requirements: !ruby/object:Gem::Requirement
79
- requirements:
80
- - - ">="
81
- - !ruby/object:Gem::Version
82
- version: '0'
83
- - !ruby/object:Gem::Dependency
84
- name: rubocop
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - ">="
88
- - !ruby/object:Gem::Version
89
- version: '0'
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - ">="
95
- - !ruby/object:Gem::Version
96
- version: '0'
97
- - !ruby/object:Gem::Dependency
98
- name: rubocop-performance
99
- requirement: !ruby/object:Gem::Requirement
100
- requirements:
101
- - - ">="
102
- - !ruby/object:Gem::Version
103
- version: '0'
104
- type: :development
105
- prerelease: false
106
- version_requirements: !ruby/object:Gem::Requirement
107
- requirements:
108
- - - ">="
109
- - !ruby/object:Gem::Version
110
- version: '0'
111
- - !ruby/object:Gem::Dependency
112
- name: rubocop-rake
113
- requirement: !ruby/object:Gem::Requirement
114
- requirements:
115
- - - ">="
116
- - !ruby/object:Gem::Version
117
- version: '0'
118
- type: :development
119
- prerelease: false
120
- version_requirements: !ruby/object:Gem::Requirement
121
- requirements:
122
- - - ">="
123
- - !ruby/object:Gem::Version
124
- version: '0'
125
- - !ruby/object:Gem::Dependency
126
- name: rubocop-rspec
127
- requirement: !ruby/object:Gem::Requirement
128
- requirements:
129
- - - ">="
130
- - !ruby/object:Gem::Version
131
- version: '0'
132
- type: :development
133
- prerelease: false
134
- version_requirements: !ruby/object:Gem::Requirement
135
- requirements:
136
- - - ">="
137
- - !ruby/object:Gem::Version
138
- version: '0'
139
41
  description: Analyze dependency using import for JavaScript.
140
42
  email:
141
43
  - jun5araki@gmail.com
@@ -152,6 +54,7 @@ files:
152
54
  - CODE_OF_CONDUCT.md
153
55
  - Gemfile
154
56
  - Gemfile.lock
57
+ - Guardfile
155
58
  - LICENSE.txt
156
59
  - README.md
157
60
  - Rakefile
@@ -200,7 +103,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
200
103
  - !ruby/object:Gem::Version
201
104
  version: '0'
202
105
  requirements: []
203
- rubygems_version: 3.3.7
106
+ rubygems_version: 3.5.3
204
107
  signing_key:
205
108
  specification_version: 4
206
109
  summary: Analyze dependency using import for JavaScript.