@@ -65,19 +65,22 @@ def self.stubbed_files
65
65
end
66
66
67
67
class SprocketsPathReader
68
- def initialize ( env )
68
+ def initialize ( env , context )
69
69
@env ||= env
70
+ @context ||= context
70
71
end
71
72
72
73
def read path
73
74
if path . end_with? '.js'
75
+ context . depend_on_asset ( path )
74
76
env [ path ] . to_s
75
77
else
78
+ context . depend_on ( path )
76
79
File . read ( env . resolve ( path ) )
77
80
end
78
81
end
79
82
80
- attr_reader :env
83
+ attr_reader :env , :context
81
84
end
82
85
83
86
def evaluate ( context , locals , &block )
@@ -95,14 +98,10 @@ def evaluate(context, locals, &block)
95
98
builder = Builder . new (
96
99
:compiler_options => options ,
97
100
:stubbed_files => stubbed_files ,
98
- :path_reader => SprocketsPathReader . new ( context . environment )
101
+ :path_reader => SprocketsPathReader . new ( context . environment , context )
99
102
)
100
103
result = builder . build_str ( data , path , prerequired )
101
104
102
- # prerequired is mutated by the builder
103
- dependencies = prerequired . uniq - stubbed_files . to_a
104
- dependencies . each { |asset | context . depend_on ( asset ) }
105
-
106
105
if self . class . source_map_enabled
107
106
$OPAL_SOURCE_MAPS[ context . pathname ] = '' #compiler.source_map(source_file_url(context)).to_s
108
107
"#{ result } \n //# sourceMappingURL=#{ source_map_url ( context ) } \n "
0 commit comments