mirror of
https://github.com/discourse/discourse.git
synced 2024-11-22 10:57:04 +08:00
2c1fc28d00
…and other auxiliary code * Restore `QUNIT_EMBER_CLI` flag warning * Add `ALLOW_EMBER_CLI_PROXY_BYPASS`
34 lines
855 B
Ruby
34 lines
855 B
Ruby
# frozen_string_literal: true
|
|
|
|
module EmberCli
|
|
ASSETS = %w(
|
|
discourse.js
|
|
admin.js
|
|
ember_jquery.js
|
|
pretty-text-bundle.js
|
|
start-discourse.js
|
|
vendor.js
|
|
)
|
|
|
|
def self.script_chunks
|
|
return @@chunk_infos if defined? @@chunk_infos
|
|
|
|
raw_chunk_infos = JSON.parse(File.read("#{Rails.configuration.root}/app/assets/javascripts/discourse/dist/chunks.json"))
|
|
|
|
chunk_infos = raw_chunk_infos["scripts"].map do |info|
|
|
logical_name = info["afterFile"][/\Aassets\/(.*)\.js\z/, 1]
|
|
chunks = info["scriptChunks"].map { |filename| filename[/\Aassets\/(.*)\.js\z/, 1] }
|
|
[logical_name, chunks]
|
|
end.to_h
|
|
|
|
@@chunk_infos = chunk_infos if Rails.env.production?
|
|
chunk_infos
|
|
rescue Errno::ENOENT
|
|
{}
|
|
end
|
|
|
|
def self.is_ember_cli_asset?(name)
|
|
ASSETS.include?(name) || name.start_with?("chunk.")
|
|
end
|
|
end
|