Skip to content

Commit 687c950

Browse files
committed
Update JS updater for v5.0.0-beta1
1 parent d4df259 commit 687c950

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

tasks/updater/js.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
class Updater
44
module Js
5+
INLINED_SRCS = %w[base-component.js util/index.js util/sanitizer.js].freeze
6+
57
def update_javascript_assets
68
log_status 'Updating javascripts...'
79
save_to = @save_to[:js]
@@ -29,13 +31,13 @@ def update_javascript_assets
2931

3032
def bootstrap_js_files
3133
@bootstrap_js_files ||= begin
32-
src_files = get_paths_by_type('js/src', /\.js$/) - %w[util/index.js util/sanitizer.js]
34+
src_files = get_paths_by_type('js/src', /\.js$/) - INLINED_SRCS
35+
puts "src_files: #{src_files.inspect}"
3336
imports = Deps.new
3437
# Get the imports from the ES6 files to order requires correctly.
3538
read_files('js/src', src_files).each do |name, content|
36-
imports.add name,
37-
*content.scan(%r{import [a-zA-Z]* from '\./([\w/-]+)})
38-
.flatten(1).map { |f| "#{f}.js" }.uniq
39+
file_imports = content.scan(%r{import *(?:[a-zA-Z]*|\{[a-zA-Z ,]*\}) *from '\./([\w/-]+)}).flatten(1).map { |f| "#{f}.js" }.uniq
40+
imports.add name, *(file_imports - INLINED_SRCS)
3941
end
4042
imports.tsort
4143
end

0 commit comments

Comments
 (0)