@@ -21,7 +21,7 @@ def source_file_for_dependency_entry(caller, dep_entry)
21
21
22
22
p = Pathname . new caller
23
23
parent_path = p . parent
24
- parent_path . join ( dep_entry ) . to_s
24
+ parent_path . join ( dep_entry + '.js' ) . to_s
25
25
end
26
26
27
27
# return a Hash of dependency info, whose keys are jquery-ui
@@ -35,16 +35,22 @@ def map_dependencies
35
35
36
36
matchdata = file . match ( /define\( .*\[ [\S \s ]+\] \, factory \) ;/m )
37
37
38
+ # fallback for core.js, which doesn't refer to factory
38
39
matchdata ||= file . match ( /define\( .*\[ [\S \s ]+\] (\, factory )?.*\) ;/m )
39
40
41
+ # skip if there's no dependencies
40
42
next if matchdata . nil?
41
43
44
+ # dirty string, with define([], factory) wrapping, comments and newlines
42
45
deps_str = matchdata [ 0 ]
43
46
47
+ # remove define([], factory) wrap
44
48
deps = deps_str . match ( /\[ [\s \S ]*\] / ) [ 0 ]
45
49
50
+ # remove lines with comments
46
51
deps = deps . gsub ( /\/ \/ .+\s / , "" )
47
52
53
+ # remove all non-path symbols, leaving only commas, dots and shashes
48
54
deps = deps . gsub ( /[\r \n \t \" \[ \] \s ]/ , "" )
49
55
50
56
deps_paths = deps . split ( ',' )
@@ -53,8 +59,6 @@ def map_dependencies
53
59
# so we remove 'jquery' from the list of dependencies for all files
54
60
deps_paths . reject! { |d | d == "jquery" }
55
61
56
- deps_paths . map! { |d | d + '.js' }
57
-
58
62
deps_paths . map! { |d | source_file_for_dependency_entry path , d }
59
63
60
64
dependencies [ basename ] = deps_paths
0 commit comments