react-manifest-rails 0.2.32 → 0.2.34

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,3 @@
1
1
  module ReactManifest
2
- VERSION = "0.2.32".freeze
2
+ VERSION = "0.2.34".freeze
3
3
  end
@@ -91,6 +91,7 @@ module ReactManifest
91
91
  end
92
92
 
93
93
  (modified + added + removed).each { |f| Scanner.invalidate(f) }
94
+ ReactManifest.invalidate_component_maps!
94
95
  schedule_regeneration(config)
95
96
  end
96
97
 
@@ -35,6 +35,15 @@ module ReactManifest
35
35
  Scanner.clear_cache!
36
36
  end
37
37
 
38
+ # Drop the cached component-symbol -> bundle map used by
39
+ # resolve_bundle_for_component / resolve_bundles_for_component(_direct).
40
+ # Unlike reset!, this does NOT touch the current Configuration — safe to
41
+ # call whenever ux/ files change (e.g. from the file watcher) so newly
42
+ # added controllers/components are picked up without losing app config.
43
+ def invalidate_component_maps!
44
+ @component_maps_cache = nil
45
+ end
46
+
38
47
  # Returns the ordered list of bundle logical names for a given controller.
39
48
  # Used by the react_bundle_tag view helper.
40
49
  def resolve_bundles(ctrl_name)
@@ -154,13 +163,16 @@ module ReactManifest
154
163
  bundle_name = ctrl[:bundle_name]
155
164
  files = js_files_in_controller(ctrl[:path], config)
156
165
  bundle_files[bundle_name].concat(files)
166
+ isolated = config.isolated_app_dirs.include?(ctrl[:name])
157
167
 
158
168
  files.each do |file_path|
159
169
  extract_defined_symbols(file_path).each do |symbol|
160
170
  next unless symbol.match?(/\A[A-Z][A-Za-z0-9_]*\z/)
161
171
 
162
172
  # Keep first writer to ensure deterministic behavior if a symbol is duplicated.
163
- symbol_to_bundle[symbol] ||= bundle_name
173
+ # Isolated dirs never register into the shared symbol index (see
174
+ # Generator#build_controller_context for the full rationale).
175
+ symbol_to_bundle[symbol] ||= bundle_name unless isolated
164
176
  bundle_own_symbols[bundle_name] << symbol
165
177
  end
166
178
  end
@@ -202,14 +214,14 @@ module ReactManifest
202
214
 
203
215
  def extract_defined_symbols(file_path)
204
216
  content = File.read(file_path, encoding: "utf-8")
205
- SymbolExtractor.extract_definitions(content)
217
+ SymbolExtractor.extract_definitions(content, file_path: file_path)
206
218
  rescue Errno::ENOENT, Errno::EACCES, Encoding::InvalidByteSequenceError
207
219
  []
208
220
  end
209
221
 
210
222
  def extract_used_component_symbols(file_path)
211
223
  content = File.read(file_path, encoding: "utf-8")
212
- SymbolExtractor.extract_usages(content)
224
+ SymbolExtractor.extract_usages(content, file_path: file_path)
213
225
  rescue Errno::ENOENT, Errno::EACCES, Encoding::InvalidByteSequenceError
214
226
  []
215
227
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: react-manifest-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.32
4
+ version: 0.2.34
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oliver Noonan
@@ -119,6 +119,20 @@ dependencies:
119
119
  - - "~>"
120
120
  - !ruby/object:Gem::Version
121
121
  version: '3.0'
122
+ - !ruby/object:Gem::Dependency
123
+ name: mini_racer
124
+ requirement: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - ">="
127
+ - !ruby/object:Gem::Version
128
+ version: '0'
129
+ type: :development
130
+ prerelease: false
131
+ version_requirements: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - ">="
134
+ - !ruby/object:Gem::Version
135
+ version: '0'
122
136
  description: |
123
137
  react-manifest-rails automatically generates per-controller Sprockets manifest
124
138
  files for Rails applications using react-rails + Sprockets. It eliminates the
@@ -137,6 +151,7 @@ files:
137
151
  - lib/react_manifest.rb
138
152
  - lib/react_manifest/application_analyzer.rb
139
153
  - lib/react_manifest/application_migrator.rb
154
+ - lib/react_manifest/ast_extractor.rb
140
155
  - lib/react_manifest/configuration.rb
141
156
  - lib/react_manifest/dependency_map.rb
142
157
  - lib/react_manifest/generator.rb
@@ -149,6 +164,11 @@ files:
149
164
  - lib/react_manifest/sprockets_manifest_patcher.rb
150
165
  - lib/react_manifest/symbol_extractor.rb
151
166
  - lib/react_manifest/tree_classifier.rb
167
+ - lib/react_manifest/vendor/ast_extractor.js
168
+ - lib/react_manifest/vendor/build/README.md
169
+ - lib/react_manifest/vendor/build/entry.js
170
+ - lib/react_manifest/vendor/build/package-lock.json
171
+ - lib/react_manifest/vendor/build/package.json
152
172
  - lib/react_manifest/version.rb
153
173
  - lib/react_manifest/view_helpers.rb
154
174
  - lib/react_manifest/watcher.rb