DEV: Compile theme raw-hbr to modules (#30299)

Previously, theme hbr files were compiled to an IIFE, which would be executed before the app is booted. That is causing silenced deprecations to be printed, because the deprecation-workflow isn't set up when the IIFE is run.

This commit updates the theme compiler so that it matches the ember-cli-based raw-hbs compiler. Templates are output to normal modules, which will then be loaded by the existing `eager-load-raw-templates` initializer. This runs after the app has started booting.
This commit is contained in:
David Taylor
2024-12-16 17:31:49 +00:00
committed by GitHub
parent 6b3e28216c
commit ea9cdf7d47
4 changed files with 27 additions and 17 deletions

View File

@ -8,15 +8,15 @@ RSpec.describe ThemeJavascriptCompiler do
template = "<h1>hello</h1>"
name = "/path/to/templates1"
compiler.append_raw_template("#{name}.raw", template)
expect(compiler.raw_content.to_s).to include("addRawTemplate(\"#{name}\"")
expect(compiler.raw_content.to_s).to include("addRawTemplate)(\"#{name}\"")
name = "/path/to/templates2"
compiler.append_raw_template("#{name}.hbr", template)
expect(compiler.raw_content.to_s).to include("addRawTemplate(\"#{name}\"")
expect(compiler.raw_content.to_s).to include("addRawTemplate)(\"#{name}\"")
name = "/path/to/templates3"
compiler.append_raw_template("#{name}.hbs", template)
expect(compiler.raw_content.to_s).to include("addRawTemplate(\"#{name}.hbs\"")
expect(compiler.raw_content.to_s).to include("addRawTemplate)(\"#{name}.hbs\"")
end
end