mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
DEV: Prefix deprecation notices with plugin name (#15942)
To make this possible in development mode, the `sourceURL=` implementation needs to include something plugin-specific. This has no effect on production. The asset version is bumped in order to trigger a re-compilation of plugin JS assets.
This commit is contained in:
@ -19,7 +19,14 @@ class DiscourseJsProcessor
|
||||
|
||||
# add sourceURL until we can do proper source maps
|
||||
unless Rails.env.production?
|
||||
data = "eval(#{data.inspect} + \"\\n//# sourceURL=#{logical_path}\");\n"
|
||||
plugin_name = root_path[/\/plugins\/([\w-]+)\/assets/, 1]
|
||||
source_url = if plugin_name
|
||||
"plugins/#{plugin_name}/assets/javascripts/#{logical_path}"
|
||||
else
|
||||
logical_path
|
||||
end
|
||||
|
||||
data = "eval(#{data.inspect} + \"\\n//# sourceURL=#{source_url}\");\n"
|
||||
end
|
||||
|
||||
{ data: data }
|
||||
|
Reference in New Issue
Block a user