Skip to content

Commit

Permalink
feat(new app-boot): replace app-boot.js with an in-html module
Browse files Browse the repository at this point in the history
  • Loading branch information
BlueCutOfficial committed Jun 13, 2024
1 parent 348291d commit 8236571
Show file tree
Hide file tree
Showing 17 changed files with 33 additions and 29 deletions.
4 changes: 0 additions & 4 deletions tests/addon-template/tests/dummy/app/app-boot.js

This file was deleted.

7 changes: 6 additions & 1 deletion tests/addon-template/tests/dummy/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@
{{content-for "body"}}

<script src="/@embroider/core/vendor.js"></script>
<script src="/app-boot.js" type="module"></script>
<script type="module">
import Application from './app';
import environment from './config/environment';

Application.create(environment.APP);
</script>

{{content-for "body-footer"}}
</body>
Expand Down
1 change: 0 additions & 1 deletion tests/addon-template/tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
<script src="/testem.js" integrity="" data-embroider-ignore></script>
<script src="/@embroider/core/vendor.js"></script>
<script src="/@embroider/core/test-support.js"></script>
<script src="/app-boot.js" type="module"></script>
<script src="/@embroider/core/test-entrypoint" type="module"></script>

{{content-for "body-footer"}}
Expand Down
4 changes: 0 additions & 4 deletions tests/app-template/app/app-boot.js

This file was deleted.

7 changes: 6 additions & 1 deletion tests/app-template/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@
{{content-for "body"}}

<script src="/@embroider/core/vendor.js"></script>
<script src="/app-boot.js" type="module"></script>
<script type="module">
import Application from './app';
import environment from './config/environment';

Application.create(environment.APP);
</script>

{{content-for "body-footer"}}
</body>
Expand Down
1 change: 0 additions & 1 deletion tests/app-template/tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
<script src="/testem.js" integrity="" data-embroider-ignore></script>
<script src="/@embroider/core/vendor.js"></script>
<script src="/@embroider/core/test-support.js"></script>
<script src="/app-boot.js" type="module"></script>
<script src="/@embroider/core/test-entrypoint" type="module"></script>

{{content-for "body-footer"}} {{content-for "test-body-footer"}}
Expand Down
1 change: 0 additions & 1 deletion tests/fixtures/macro-test/tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
<script src="{{rootURL}}apple.js"></script>
<script src="{{rootURL}}ordered.js"></script>
<script src="/@embroider/core/test-support.js"></script>
<script src="/app-boot.js" type="module"></script>
<script src="/@embroider/core/test-entrypoint" type="module"></script>

{{content-for "body-footer"}}
Expand Down
7 changes: 6 additions & 1 deletion tests/scenarios/compat-addon-classic-features-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,12 @@ appScenarios
{{content-for "custom"}}
<script src="/@embroider/core/vendor.js"></script>
<script src="/app-boot.js" type="module"></script>
<script type="module">
import Application from './app';
import environment from './config/environment';
Application.create(environment.APP);
</script>
{{content-for "body-footer"}}
</body>
Expand Down
4 changes: 2 additions & 2 deletions tests/scenarios/compat-app-html-attributes-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ appScenarios

// <script ... src=".../vendor.js"> => <script ... src=".../vendor.js" data-original-filename="vendor.js">
indexHtml = indexHtml.replace('vendor.js">', 'vendor.js" data-original-filename="vendor.js">');
indexHtml = indexHtml.replace('/app-boot.js" ', '/app-boot.js" data-original-filename="entrypoint" ');
indexHtml = indexHtml.replace(' type="module">', ' data-original-filename="entrypoint" type="module">');

// <script ... => <script defer ...
indexHtml = indexHtml.replace(/<script /g, '<script defer ');
Expand Down Expand Up @@ -72,7 +72,7 @@ appScenarios
'has data-original-filename vendor.js'
);
expectFile('./index.html').matches(
'" data-original-filename="entrypoint" type="module">',
' data-original-filename="entrypoint" type="module">',
'has data-original-filename entrypoint'
);
});
Expand Down
2 changes: 1 addition & 1 deletion tests/scenarios/compat-exclude-dot-files-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ appScenarios
// but not be picked up in the entrypoint
expectAudit
.module('./tmp/rewritten-app/index.html')
.resolves('/app-boot.js')
.resolves(/\/index.html.*/) // in-html app-boot script
.toModule()
.resolves('./app')
.toModule()
Expand Down
2 changes: 1 addition & 1 deletion tests/scenarios/compat-renaming-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ appScenarios
test('renamed modules keep their classic runtime name when used as implicit-modules', function () {
expectAudit
.module('./tmp/rewritten-app/index.html')
.resolves('/app-boot.js')
.resolves(/\/index.html.*/) // in-html app-boot script
.toModule()
.resolves('./app')
.toModule()
Expand Down
2 changes: 1 addition & 1 deletion tests/scenarios/compat-route-split-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function checkContents(
) {
let resolved = expectAudit
.module('./index.html')
.resolves('/app-boot.js')
.resolves(/\/index.html.*/) // in-html app-boot script
.toModule()
.resolves(/\/app\.[jt]s.*/)
.toModule()
Expand Down
2 changes: 1 addition & 1 deletion tests/scenarios/compat-stage2-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ let stage2Scenarios = appScenarios.map('compat-stage2-build', app => {
function resolveEntryPoint(expectAudit: ReturnType<typeof setupAuditTest>) {
return expectAudit
.module('./tmp/rewritten-app/index.html')
.resolves('/app-boot.js')
.resolves(/\/index.html.*/) // in-html app-boot script
.toModule()
.resolves('./app')
.toModule()
Expand Down
6 changes: 3 additions & 3 deletions tests/scenarios/compat-template-colocation-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ function checkContents(
) {
let resolved = expectAudit
.module('./index.html')
.resolves('/app-boot.js')
.resolves(/\/index.html.*/) // in-html app-boot script
.toModule()
.resolves(/\/app\.[jt]s.*/)
.toModule()
Expand Down Expand Up @@ -264,7 +264,7 @@ scenarios
test(`app's colocated components are not implicitly included`, function (assert) {
expectAudit
.module('./tmp/rewritten-app/index.html')
.resolves('/app-boot.js')
.resolves(/\/index.html.*/) // in-html app-boot script
.toModule()
.resolves('./app')
.toModule()
Expand Down Expand Up @@ -361,7 +361,7 @@ appScenarios
test(`app's pod components and templates are implicitly included correctly`, function (assert) {
expectAudit
.module('./tmp/rewritten-app/index.html')
.resolves('/app-boot.js')
.resolves(/\/index.html.*/) // in-html app-boot script
.toModule()
.resolves('./app')
.toModule()
Expand Down
4 changes: 0 additions & 4 deletions tests/ts-app-template/app/app-boot.js

This file was deleted.

7 changes: 6 additions & 1 deletion tests/ts-app-template/app/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,12 @@
{{content-for "body"}}

<script src="/@embroider/core/vendor.js"></script>
<script src="/app-boot.js" type="module"></script>
<script type="module">
import Application from './app';
import environment from './config/environment';

Application.create(environment.APP);
</script>

{{content-for "body-footer"}}
</body>
Expand Down
1 change: 0 additions & 1 deletion tests/ts-app-template/tests/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
<script src="/testem.js" integrity="" data-embroider-ignore></script>
<script src="/@embroider/core/vendor.js"></script>
<script src="/@embroider/core/test-support.js"></script>
<script src="/app-boot.js" type="module"></script>
<script src="/@embroider/core/test-entrypoint" type="module"></script>

{{content-for "body-footer"}}
Expand Down

0 comments on commit 8236571

Please sign in to comment.