This reverts commit 2c58d456dd
.
This commit is contained in:
parent
9821ca9413
commit
24d46fd981
|
@ -22,11 +22,9 @@
|
||||||
<link integrity="" rel="stylesheet" href="{{rootURL}}assets/discourse.css" />
|
<link integrity="" rel="stylesheet" href="{{rootURL}}assets/discourse.css" />
|
||||||
|
|
||||||
<script defer src="{{rootURL}}assets/vendor.js"></script>
|
<script defer src="{{rootURL}}assets/vendor.js"></script>
|
||||||
|
<script defer src="{{rootURL}}assets/discourse.js"></script>
|
||||||
|
|
||||||
<discourse-chunked-script entrypoint="discourse">
|
<ember-auto-import-scripts defer entrypoint="app"></ember-auto-import-scripts>
|
||||||
<ember-auto-import-scripts defer entrypoint="app"></ember-auto-import-scripts>
|
|
||||||
<script defer src="{{rootURL}}assets/discourse.js"></script>
|
|
||||||
</discourse-chunked-script>
|
|
||||||
|
|
||||||
<bootstrap-content key="head"></bootstrap-content>
|
<bootstrap-content key="head"></bootstrap-content>
|
||||||
{{content-for "head"}}
|
{{content-for "head"}}
|
||||||
|
|
|
@ -59,6 +59,7 @@
|
||||||
"discourse-common": "1.0.0",
|
"discourse-common": "1.0.0",
|
||||||
"discourse-plugins": "1.0.0",
|
"discourse-plugins": "1.0.0",
|
||||||
"ember-auto-import": "^2.6.3",
|
"ember-auto-import": "^2.6.3",
|
||||||
|
"ember-auto-import-chunks-json-generator": "^1.1.0",
|
||||||
"ember-buffered-proxy": "^2.1.1",
|
"ember-buffered-proxy": "^2.1.1",
|
||||||
"ember-cached-decorator-polyfill": "^1.0.2",
|
"ember-cached-decorator-polyfill": "^1.0.2",
|
||||||
"ember-cli": "~5.0.0",
|
"ember-cli": "~5.0.0",
|
||||||
|
|
|
@ -49,17 +49,10 @@
|
||||||
|
|
||||||
<script src="/testem.js" integrity="" data-embroider-ignore></script>
|
<script src="/testem.js" integrity="" data-embroider-ignore></script>
|
||||||
<script src="{{rootURL}}assets/vendor.js"></script>
|
<script src="{{rootURL}}assets/vendor.js"></script>
|
||||||
|
<ember-auto-import-scripts entrypoint="app"></ember-auto-import-scripts>
|
||||||
<discourse-chunked-script entrypoint="test-support">
|
<script src="{{rootURL}}assets/test-support.js"></script>
|
||||||
<script src="{{rootURL}}assets/test-support.js"></script>
|
<ember-auto-import-scripts entrypoint="tests"></ember-auto-import-scripts>
|
||||||
<ember-auto-import-scripts entrypoint="tests"></ember-auto-import-scripts>
|
<script src="{{rootURL}}assets/discourse.js"></script>
|
||||||
</discourse-chunked-script>
|
|
||||||
|
|
||||||
<discourse-chunked-script entrypoint="discourse">
|
|
||||||
<ember-auto-import-scripts entrypoint="app"></ember-auto-import-scripts>
|
|
||||||
<script src="{{rootURL}}assets/discourse.js"></script>
|
|
||||||
</discourse-chunked-script>
|
|
||||||
|
|
||||||
<script src="{{rootURL}}assets/markdown-it-bundle.js"></script>
|
<script src="{{rootURL}}assets/markdown-it-bundle.js"></script>
|
||||||
<script src="{{rootURL}}assets/admin.js"></script>
|
<script src="{{rootURL}}assets/admin.js"></script>
|
||||||
<script src="{{rootURL}}assets/wizard.js"></script>
|
<script src="{{rootURL}}assets/wizard.js"></script>
|
||||||
|
|
|
@ -3730,6 +3730,16 @@ electron-to-chromium@^1.4.477:
|
||||||
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.496.tgz#a57534b70d2bdee7e1ad7dbd4c91e560cbd08db1"
|
resolved "https://registry.yarnpkg.com/electron-to-chromium/-/electron-to-chromium-1.4.496.tgz#a57534b70d2bdee7e1ad7dbd4c91e560cbd08db1"
|
||||||
integrity sha512-qeXC3Zbykq44RCrBa4kr8v/dWzYJA8rAwpyh9Qd+NKWoJfjG5vvJqy9XOJ9H4P/lqulZBCgUWAYi+FeK5AuJ8g==
|
integrity sha512-qeXC3Zbykq44RCrBa4kr8v/dWzYJA8rAwpyh9Qd+NKWoJfjG5vvJqy9XOJ9H4P/lqulZBCgUWAYi+FeK5AuJ8g==
|
||||||
|
|
||||||
|
ember-auto-import-chunks-json-generator@^1.1.0:
|
||||||
|
version "1.1.0"
|
||||||
|
resolved "https://registry.yarnpkg.com/ember-auto-import-chunks-json-generator/-/ember-auto-import-chunks-json-generator-1.1.0.tgz#9b3ee4b6e2f274fdbf722762fc9d72f13942a594"
|
||||||
|
integrity sha512-50JvuBVD5mLx+9YMcBLlV8HIVdtdHHzEfVwID8jo8yRo83x5SAKULdSH+ZwwNTYcUNI7amMKDl9RA5LBGzbDWA==
|
||||||
|
dependencies:
|
||||||
|
broccoli-merge-trees "^4.2.0"
|
||||||
|
broccoli-plugin "^4.0.7"
|
||||||
|
ember-cli-babel "^7.26.11"
|
||||||
|
ember-cli-htmlbars "^6.1.1"
|
||||||
|
|
||||||
ember-auto-import@^2.2.3, ember-auto-import@^2.5.0, ember-auto-import@^2.6.0, ember-auto-import@^2.6.3:
|
ember-auto-import@^2.2.3, ember-auto-import@^2.5.0, ember-auto-import@^2.6.0, ember-auto-import@^2.6.3:
|
||||||
version "2.6.3"
|
version "2.6.3"
|
||||||
resolved "https://registry.yarnpkg.com/ember-auto-import/-/ember-auto-import-2.6.3.tgz#f18d1b93dd10b08ba5496518436f9d56dd4e000a"
|
resolved "https://registry.yarnpkg.com/ember-auto-import/-/ember-auto-import-2.6.3.tgz#f18d1b93dd10b08ba5496518436f9d56dd4e000a"
|
||||||
|
|
|
@ -133,12 +133,10 @@ module ApplicationHelper
|
||||||
end
|
end
|
||||||
|
|
||||||
def preload_script(script)
|
def preload_script(script)
|
||||||
scripts = []
|
scripts = [script]
|
||||||
|
|
||||||
if chunks = EmberCli.script_chunks[script]
|
if chunks = EmberCli.script_chunks[script]
|
||||||
scripts.push(*chunks)
|
scripts.push(*chunks)
|
||||||
else
|
|
||||||
scripts.push(script)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
scripts
|
scripts
|
||||||
|
|
|
@ -37,15 +37,19 @@ module EmberCli
|
||||||
def self.script_chunks
|
def self.script_chunks
|
||||||
return @@chunk_infos if defined?(@@chunk_infos)
|
return @@chunk_infos if defined?(@@chunk_infos)
|
||||||
|
|
||||||
chunk_infos = {}
|
raw_chunk_infos =
|
||||||
|
JSON.parse(
|
||||||
|
File.read("#{Rails.configuration.root}/app/assets/javascripts/discourse/dist/chunks.json"),
|
||||||
|
)
|
||||||
|
|
||||||
begin
|
chunk_infos =
|
||||||
chunk_infos.merge! parse_chunks_from_html("tests/index.html")
|
raw_chunk_infos["scripts"]
|
||||||
rescue Errno::ENOENT
|
.map do |info|
|
||||||
# production build
|
logical_name = info["afterFile"][%r{\Aassets/(.*)\.js\z}, 1]
|
||||||
end
|
chunks = info["scriptChunks"].map { |filename| filename[%r{\Aassets/(.*)\.js\z}, 1] }
|
||||||
|
[logical_name, chunks]
|
||||||
chunk_infos.merge! parse_chunks_from_html("index.html")
|
end
|
||||||
|
.to_h
|
||||||
|
|
||||||
@@chunk_infos = chunk_infos if Rails.env.production?
|
@@chunk_infos = chunk_infos if Rails.env.production?
|
||||||
chunk_infos
|
chunk_infos
|
||||||
|
@ -74,22 +78,4 @@ module EmberCli
|
||||||
File.basename(full_path)
|
File.basename(full_path)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.parse_chunks_from_html(path)
|
|
||||||
html = File.read("#{Rails.root}/app/assets/javascripts/discourse/dist/#{path}")
|
|
||||||
doc = Nokogiri::HTML5.parse(html)
|
|
||||||
|
|
||||||
chunk_infos = {}
|
|
||||||
|
|
||||||
doc
|
|
||||||
.css("discourse-chunked-script")
|
|
||||||
.each do |discourse_script|
|
|
||||||
entrypoint = discourse_script.attr("entrypoint")
|
|
||||||
chunk_infos[entrypoint] = discourse_script
|
|
||||||
.css("script[src]")
|
|
||||||
.map { |script| script.attr("src")[%r{\A/assets/(.*)\.js\z}, 1] }
|
|
||||||
end
|
|
||||||
|
|
||||||
chunk_infos
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue