From 519ffe1385ea4b5b0ce3df9776269a464b584226 Mon Sep 17 00:00:00 2001 From: Marine Dunstetter Date: Thu, 16 May 2024 12:00:56 +0200 Subject: [PATCH 1/4] tests(new index.html): use the virtual test-support.css in the index.html of all test apps --- test-packages/sample-transforms/tests/index.html | 2 +- tests/addon-template/tests/index.html | 2 +- tests/app-template/tests/index.html | 2 +- tests/fixtures/macro-test/tests/index.html | 2 +- tests/ts-app-template/tests/index.html | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/test-packages/sample-transforms/tests/index.html b/test-packages/sample-transforms/tests/index.html index ae3012677..a0a47551a 100644 --- a/test-packages/sample-transforms/tests/index.html +++ b/test-packages/sample-transforms/tests/index.html @@ -12,7 +12,7 @@ - + {{content-for "head-footer"}} {{content-for "test-head-footer"}} diff --git a/tests/addon-template/tests/index.html b/tests/addon-template/tests/index.html index 5ca2204c7..9238f7878 100644 --- a/tests/addon-template/tests/index.html +++ b/tests/addon-template/tests/index.html @@ -11,7 +11,7 @@ - + {{content-for "head-footer"}} {{content-for "test-head-footer"}} diff --git a/tests/app-template/tests/index.html b/tests/app-template/tests/index.html index 75cae7486..a6ff92f09 100644 --- a/tests/app-template/tests/index.html +++ b/tests/app-template/tests/index.html @@ -10,7 +10,7 @@ - + {{content-for "head-footer"}} {{content-for "test-head-footer"}} diff --git a/tests/fixtures/macro-test/tests/index.html b/tests/fixtures/macro-test/tests/index.html index f65bdb234..793fde5b0 100644 --- a/tests/fixtures/macro-test/tests/index.html +++ b/tests/fixtures/macro-test/tests/index.html @@ -12,7 +12,7 @@ - + {{content-for "head-footer"}} {{content-for "test-head-footer"}} diff --git a/tests/ts-app-template/tests/index.html b/tests/ts-app-template/tests/index.html index d7b9e3e3b..e3e0bad67 100644 --- a/tests/ts-app-template/tests/index.html +++ b/tests/ts-app-template/tests/index.html @@ -11,7 +11,7 @@ - + {{content-for "head-footer"}} {{content-for "test-head-footer"}} From a21a357c8991b5abeea5cc305a27c32666a48b6f Mon Sep 17 00:00:00 2001 From: Marine Dunstetter Date: Thu, 16 May 2024 12:05:33 +0200 Subject: [PATCH 2/4] feat(new index.html): pass the test-support.css entry point from app to rewritten-app --- packages/compat/src/compat-app-builder.ts | 3 --- packages/compat/src/compat-app.ts | 6 ------ packages/core/src/ember-html.ts | 14 +------------- 3 files changed, 1 insertion(+), 22 deletions(-) diff --git a/packages/compat/src/compat-app-builder.ts b/packages/compat/src/compat-app-builder.ts index aea8cd9aa..ddde258d1 100644 --- a/packages/compat/src/compat-app-builder.ts +++ b/packages/compat/src/compat-app-builder.ts @@ -214,7 +214,6 @@ export class CompatAppBuilder { implicitScripts: this.compatApp.findVendorScript(scripts, entrypoint), implicitStyles: this.compatApp.findVendorStyles(styles, entrypoint), testJavascript: this.compatApp.findTestScript(scripts), - implicitTestStyles: this.compatApp.findTestSupportStyles(styles), }; }, }; @@ -475,8 +474,6 @@ export class CompatAppBuilder { let testJS = this.testJSEntrypoint(appFiles, prepared); html.insertScriptTag(html.testJavascript, testJS.relativePath, { type: 'module' }); - - html.insertStyleLink(html.implicitTestStyles, '@embroider/core/test-support.css'); } // recurse to find all active addons that don't cross an engine boundary. diff --git a/packages/compat/src/compat-app.ts b/packages/compat/src/compat-app.ts index 864b1b146..56f4c7a22 100644 --- a/packages/compat/src/compat-app.ts +++ b/packages/compat/src/compat-app.ts @@ -751,12 +751,6 @@ export default class CompatApp { ); } - findTestSupportStyles(styles: HTMLLinkElement[]): HTMLLinkElement | undefined { - return styles.find( - style => this.withoutRootURL(style.href) === this.legacyEmberAppInstance.options.outputPaths.testSupport.css - ); - } - findTestScript(scripts: HTMLScriptElement[]): HTMLScriptElement | undefined { return scripts.find( script => this.withoutRootURL(script.src) === this.legacyEmberAppInstance.options.outputPaths.tests.js diff --git a/packages/core/src/ember-html.ts b/packages/core/src/ember-html.ts index 73316a9f9..5e512308c 100644 --- a/packages/core/src/ember-html.ts +++ b/packages/core/src/ember-html.ts @@ -22,7 +22,6 @@ export interface EmberHTML { // Do not confuse these with controlling whether or not we will insert tests. // That is separately controlled via `includeTests`. testJavascript?: Node; - implicitTestStyles?: Node; } class Placeholder { @@ -83,7 +82,6 @@ export class PreparedEmberHTML { implicitScripts: Placeholder; implicitStyles: Placeholder; testJavascript: Placeholder; - implicitTestStyles: Placeholder; constructor(private asset: EmberAsset) { this.dom = new JSDOM(readFileSync(asset.sourcePath, 'utf8')); @@ -95,20 +93,10 @@ export class PreparedEmberHTML { this.testJavascript = html.testJavascript ? Placeholder.replacing(html.testJavascript) : Placeholder.immediatelyAfter(this.javascript.end); - this.implicitTestStyles = html.implicitTestStyles - ? Placeholder.replacing(html.implicitTestStyles) - : Placeholder.immediatelyAfter(this.implicitStyles.end); } private placeholders(): Placeholder[] { - return [ - this.javascript, - this.styles, - this.implicitScripts, - this.implicitStyles, - this.implicitTestStyles, - this.testJavascript, - ]; + return [this.javascript, this.styles, this.implicitScripts, this.implicitStyles, this.testJavascript]; } clear() { From 19e146fafe039b7ec7fd7ce04d0350f13644463c Mon Sep 17 00:00:00 2001 From: Marine Dunstetter Date: Thu, 16 May 2024 12:42:18 +0200 Subject: [PATCH 3/4] tests(new index.html): use the virtual vendor.css in the index.html of all test apps --- packages/util/tests/dummy/app/index.html | 2 +- test-packages/sample-transforms/tests/dummy/app/index.html | 2 +- test-packages/sample-transforms/tests/index.html | 2 +- tests/addon-template/tests/dummy/app/index.html | 2 +- tests/addon-template/tests/index.html | 2 +- tests/app-template/app/index.html | 2 +- tests/app-template/tests/index.html | 2 +- tests/fixtures/macro-test/tests/index.html | 2 +- tests/scenarios/compat-addon-classic-features-test.ts | 2 +- tests/ts-app-template/app/index.html | 2 +- tests/ts-app-template/tests/index.html | 2 +- 11 files changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/util/tests/dummy/app/index.html b/packages/util/tests/dummy/app/index.html index e134b0dc7..92c6645e1 100644 --- a/packages/util/tests/dummy/app/index.html +++ b/packages/util/tests/dummy/app/index.html @@ -8,7 +8,7 @@ {{content-for "head"}} - + {{content-for "head-footer"}} diff --git a/test-packages/sample-transforms/tests/dummy/app/index.html b/test-packages/sample-transforms/tests/dummy/app/index.html index 3b1c4d1fc..44866f1ae 100644 --- a/test-packages/sample-transforms/tests/dummy/app/index.html +++ b/test-packages/sample-transforms/tests/dummy/app/index.html @@ -9,7 +9,7 @@ {{content-for "head"}} - + {{content-for "head-footer"}} diff --git a/test-packages/sample-transforms/tests/index.html b/test-packages/sample-transforms/tests/index.html index a0a47551a..2710482a6 100644 --- a/test-packages/sample-transforms/tests/index.html +++ b/test-packages/sample-transforms/tests/index.html @@ -10,7 +10,7 @@ {{content-for "head"}} {{content-for "test-head"}} - + diff --git a/tests/addon-template/tests/dummy/app/index.html b/tests/addon-template/tests/dummy/app/index.html index e134b0dc7..92c6645e1 100644 --- a/tests/addon-template/tests/dummy/app/index.html +++ b/tests/addon-template/tests/dummy/app/index.html @@ -8,7 +8,7 @@ {{content-for "head"}} - + {{content-for "head-footer"}} diff --git a/tests/addon-template/tests/index.html b/tests/addon-template/tests/index.html index 9238f7878..15da9641c 100644 --- a/tests/addon-template/tests/index.html +++ b/tests/addon-template/tests/index.html @@ -9,7 +9,7 @@ {{content-for "head"}} {{content-for "test-head"}} - + diff --git a/tests/app-template/app/index.html b/tests/app-template/app/index.html index 36686430b..2450e01f3 100644 --- a/tests/app-template/app/index.html +++ b/tests/app-template/app/index.html @@ -8,7 +8,7 @@ {{content-for "head"}} - + {{content-for "head-footer"}} diff --git a/tests/app-template/tests/index.html b/tests/app-template/tests/index.html index a6ff92f09..92444ebab 100644 --- a/tests/app-template/tests/index.html +++ b/tests/app-template/tests/index.html @@ -8,7 +8,7 @@ {{content-for "head"}} {{content-for "test-head"}} - + diff --git a/tests/fixtures/macro-test/tests/index.html b/tests/fixtures/macro-test/tests/index.html index 793fde5b0..8c40280e9 100644 --- a/tests/fixtures/macro-test/tests/index.html +++ b/tests/fixtures/macro-test/tests/index.html @@ -10,7 +10,7 @@ {{content-for "head"}} {{content-for "test-head"}} - + diff --git a/tests/scenarios/compat-addon-classic-features-test.ts b/tests/scenarios/compat-addon-classic-features-test.ts index 6f5f854c4..c7e82d034 100644 --- a/tests/scenarios/compat-addon-classic-features-test.ts +++ b/tests/scenarios/compat-addon-classic-features-test.ts @@ -72,7 +72,7 @@ appScenarios {{content-for "head"}} - + {{content-for "head-footer"}} diff --git a/tests/ts-app-template/app/index.html b/tests/ts-app-template/app/index.html index bb8e5410c..e728e1c61 100644 --- a/tests/ts-app-template/app/index.html +++ b/tests/ts-app-template/app/index.html @@ -8,7 +8,7 @@ {{content-for "head"}} - + {{content-for "head-footer"}} diff --git a/tests/ts-app-template/tests/index.html b/tests/ts-app-template/tests/index.html index e3e0bad67..cad5684b7 100644 --- a/tests/ts-app-template/tests/index.html +++ b/tests/ts-app-template/tests/index.html @@ -9,7 +9,7 @@ {{content-for "head"}} {{content-for "test-head"}} - + From 47016ad364845b5a521f6f51f19dfa83aa8cfcc6 Mon Sep 17 00:00:00 2001 From: Marine Dunstetter Date: Thu, 16 May 2024 12:46:09 +0200 Subject: [PATCH 4/4] feat(new index.html): pass the vendor.css entry point from app to rewritten-app --- packages/compat/src/compat-app-builder.ts | 4 ---- packages/compat/src/compat-app.ts | 13 ------------- packages/core/src/ember-html.ts | 5 +---- 3 files changed, 1 insertion(+), 21 deletions(-) diff --git a/packages/compat/src/compat-app-builder.ts b/packages/compat/src/compat-app-builder.ts index ddde258d1..c6678f67c 100644 --- a/packages/compat/src/compat-app-builder.ts +++ b/packages/compat/src/compat-app-builder.ts @@ -212,7 +212,6 @@ export class CompatAppBuilder { javascript: this.compatApp.findAppScript(scripts, entrypoint), styles: this.compatApp.findAppStyles(styles, entrypoint), implicitScripts: this.compatApp.findVendorScript(scripts, entrypoint), - implicitStyles: this.compatApp.findVendorStyles(styles, entrypoint), testJavascript: this.compatApp.findTestScript(scripts), }; }, @@ -463,9 +462,6 @@ export class CompatAppBuilder { } } - // virtual vendor.css entrypoint - html.insertStyleLink(html.implicitStyles, '@embroider/core/vendor.css'); - if (!asset.fileAsset.includeTests) { return; } diff --git a/packages/compat/src/compat-app.ts b/packages/compat/src/compat-app.ts index 56f4c7a22..499f6c8e7 100644 --- a/packages/compat/src/compat-app.ts +++ b/packages/compat/src/compat-app.ts @@ -738,19 +738,6 @@ export default class CompatApp { ); } - findVendorStyles(styles: HTMLLinkElement[], entrypoint: string): HTMLLinkElement { - let vendorStyle = styles.find( - style => this.withoutRootURL(style.href) === this.legacyEmberAppInstance.options.outputPaths.vendor.css - ); - return throwIfMissing( - vendorStyle, - this.legacyEmberAppInstance.options.outputPaths.vendor.css, - styles.map(s => s.href), - entrypoint, - 'vendor css' - ); - } - findTestScript(scripts: HTMLScriptElement[]): HTMLScriptElement | undefined { return scripts.find( script => this.withoutRootURL(script.src) === this.legacyEmberAppInstance.options.outputPaths.tests.js diff --git a/packages/core/src/ember-html.ts b/packages/core/src/ember-html.ts index 5e512308c..5f0e4475f 100644 --- a/packages/core/src/ember-html.ts +++ b/packages/core/src/ember-html.ts @@ -12,7 +12,6 @@ export interface EmberHTML { javascript: Node; styles: Node; implicitScripts: Node; - implicitStyles: Node; // these are optional because you *may* choose to stick your implicit test // things into specific locations (which we need for backward-compat). But you @@ -80,7 +79,6 @@ export class PreparedEmberHTML { javascript: Placeholder; styles: Placeholder; implicitScripts: Placeholder; - implicitStyles: Placeholder; testJavascript: Placeholder; constructor(private asset: EmberAsset) { @@ -89,14 +87,13 @@ export class PreparedEmberHTML { this.javascript = Placeholder.replacing(html.javascript); this.styles = Placeholder.replacing(html.styles); this.implicitScripts = Placeholder.find(html.implicitScripts); - this.implicitStyles = Placeholder.replacing(html.implicitStyles); this.testJavascript = html.testJavascript ? Placeholder.replacing(html.testJavascript) : Placeholder.immediatelyAfter(this.javascript.end); } private placeholders(): Placeholder[] { - return [this.javascript, this.styles, this.implicitScripts, this.implicitStyles, this.testJavascript]; + return [this.javascript, this.styles, this.implicitScripts, this.testJavascript]; } clear() {