From b569db005e7a614c5d331cd15a19c7a22e27f4cb Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Thu, 3 Oct 2024 11:05:48 -0400 Subject: [PATCH 1/2] Rename vendor.* to be from @embroider/virtual instead of @embroider/core --- packages/core/src/module-resolver.ts | 8 ++++---- packages/core/src/virtual-entrypoint.ts | 2 +- packages/vite/src/resolver.ts | 2 +- tests/addon-template/tests/dummy/index.html | 4 ++-- tests/addon-template/tests/index.html | 4 ++-- tests/app-template/index.html | 4 ++-- tests/app-template/tests/index.html | 4 ++-- .../macro-sample-addon/tests/dummy/app/index.html | 4 ++-- tests/fixtures/macro-sample-addon/tests/index.html | 4 ++-- tests/fixtures/macro-test/tests/index.html | 4 ++-- tests/scenarios/compat-addon-classic-features-test.ts | 10 +++++----- tests/ts-app-template/index.html | 4 ++-- tests/ts-app-template/tests/index.html | 4 ++-- 13 files changed, 29 insertions(+), 29 deletions(-) diff --git a/packages/core/src/module-resolver.ts b/packages/core/src/module-resolver.ts index a6dc96297..a36cbdc6a 100644 --- a/packages/core/src/module-resolver.ts +++ b/packages/core/src/module-resolver.ts @@ -560,7 +560,7 @@ export class Resolver { private handleVendorStyles(request: R): R { //TODO move the extra forwardslash handling out into the vite plugin - const candidates = ['@embroider/core/vendor.css', '/@embroider/core/vendor.css', './@embroider/core/vendor.css']; + const candidates = ['@embroider/virtual/vendor.css', '/@embroider/virtual/vendor.css', './@embroider/virtual/vendor.css']; if (!candidates.includes(request.specifier)) { return request; @@ -569,7 +569,7 @@ export class Resolver { let pkg = this.packageCache.ownerOfFile(request.fromFile); if (!pkg || !this.options.engines.some(e => e.root === pkg?.root)) { throw new Error( - `bug: found an import of ${request.specifier} in ${request.fromFile}, but this is not the top-level Ember app or Engine. The top-level Ember app is the only one that has support for @embroider/core/vendor.css. If you think something should be fixed in Embroider, please open an issue on https://github.com/embroider-build/embroider/issues.` + `bug: found an import of ${request.specifier} in ${request.fromFile}, but this is not the top-level Ember app or Engine. The top-level Ember app is the only one that has support for @embroider/virtual/vendor.css. If you think something should be fixed in Embroider, please open an issue on https://github.com/embroider-build/embroider/issues.` ); } @@ -1029,7 +1029,7 @@ export class Resolver { private handleVendor(request: R): R { //TODO move the extra forwardslash handling out into the vite plugin - const candidates = ['@embroider/core/vendor.js', '/@embroider/core/vendor.js', './@embroider/core/vendor.js']; + const candidates = ['@embroider/virtual/vendor.js', '/@embroider/virtual/vendor.js', './@embroider/virtual/vendor.js']; if (!candidates.includes(request.specifier)) { return request; @@ -1038,7 +1038,7 @@ export class Resolver { let pkg = this.packageCache.ownerOfFile(request.fromFile); if (pkg?.root !== this.options.engines[0].root) { throw new Error( - `bug: found an import of ${request.specifier} in ${request.fromFile}, but this is not the top-level Ember app. The top-level Ember app is the only one that has support for @embroider/core/vendor.js. If you think something should be fixed in Embroider, please open an issue on https://github.com/embroider-build/embroider/issues.` + `bug: found an import of ${request.specifier} in ${request.fromFile}, but this is not the top-level Ember app. The top-level Ember app is the only one that has support for @embroider/virtual/vendor.js. If you think something should be fixed in Embroider, please open an issue on https://github.com/embroider-build/embroider/issues.` ); } diff --git a/packages/core/src/virtual-entrypoint.ts b/packages/core/src/virtual-entrypoint.ts index 8b4de6685..e2d21adc2 100644 --- a/packages/core/src/virtual-entrypoint.ts +++ b/packages/core/src/virtual-entrypoint.ts @@ -87,7 +87,7 @@ export function renderEntrypoint( // will be inserted via a direct tag. if (!appFiles.engine.isApp && appFiles.engine.package.isLazyEngine()) { styles.push({ - path: '@embroider/core/vendor.css', + path: '@embroider/virtual/vendor.css', }); } diff --git a/packages/vite/src/resolver.ts b/packages/vite/src/resolver.ts index 7df743f57..922388b5b 100644 --- a/packages/vite/src/resolver.ts +++ b/packages/vite/src/resolver.ts @@ -70,7 +70,7 @@ export function resolver(): Plugin { buildEnd() { this.emitFile({ type: 'asset', - fileName: '@embroider/core/vendor.js', + fileName: '@embroider/virtual/vendor.js', source: virtualContent( resolve(resolverLoader.resolver.options.engines[0].root, '-embroider-vendor.js'), resolverLoader.resolver diff --git a/tests/addon-template/tests/dummy/index.html b/tests/addon-template/tests/dummy/index.html index 44af3dc9b..4f2e1d6f0 100644 --- a/tests/addon-template/tests/dummy/index.html +++ b/tests/addon-template/tests/dummy/index.html @@ -8,7 +8,7 @@ {{content-for "head"}} - + {{content-for "head-footer"}} @@ -16,7 +16,7 @@ {{content-for "body"}} - + - + diff --git a/tests/app-template/index.html b/tests/app-template/index.html index 60a4b93e5..b385800fa 100644 --- a/tests/app-template/index.html +++ b/tests/app-template/index.html @@ -8,7 +8,7 @@ {{content-for "head"}} - + {{content-for "head-footer"}} @@ -16,7 +16,7 @@ {{content-for "body"}} - + - + diff --git a/tests/fixtures/macro-sample-addon/tests/dummy/app/index.html b/tests/fixtures/macro-sample-addon/tests/dummy/app/index.html index 8dfc7c9bd..ed5dab348 100644 --- a/tests/fixtures/macro-sample-addon/tests/dummy/app/index.html +++ b/tests/fixtures/macro-sample-addon/tests/dummy/app/index.html @@ -8,7 +8,7 @@ {{content-for "head"}} - + {{content-for "head-footer"}} @@ -16,7 +16,7 @@ {{content-for "body"}} - + - + diff --git a/tests/fixtures/macro-test/tests/index.html b/tests/fixtures/macro-test/tests/index.html index c231c4e5e..ffcb8d4d4 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"}} - + @@ -32,7 +32,7 @@ self.ORDER = []; - + diff --git a/tests/scenarios/compat-addon-classic-features-test.ts b/tests/scenarios/compat-addon-classic-features-test.ts index a6ef2a8e0..2849d7443 100644 --- a/tests/scenarios/compat-addon-classic-features-test.ts +++ b/tests/scenarios/compat-addon-classic-features-test.ts @@ -71,7 +71,7 @@ appScenarios {{content-for "head"}} - + {{content-for "head-footer"}} @@ -80,7 +80,7 @@ appScenarios {{content-for "body"}} {{content-for "custom"}} - + + - + From 51eb294f95e1bfbdbdd275b85e1179ae12487af7 Mon Sep 17 00:00:00 2001 From: NullVoxPopuli <199018+NullVoxPopuli@users.noreply.github.com> Date: Thu, 3 Oct 2024 11:18:17 -0400 Subject: [PATCH 2/2] lint:fix --- packages/core/src/module-resolver.ts | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/core/src/module-resolver.ts b/packages/core/src/module-resolver.ts index a36cbdc6a..a14661178 100644 --- a/packages/core/src/module-resolver.ts +++ b/packages/core/src/module-resolver.ts @@ -560,7 +560,11 @@ export class Resolver { private handleVendorStyles(request: R): R { //TODO move the extra forwardslash handling out into the vite plugin - const candidates = ['@embroider/virtual/vendor.css', '/@embroider/virtual/vendor.css', './@embroider/virtual/vendor.css']; + const candidates = [ + '@embroider/virtual/vendor.css', + '/@embroider/virtual/vendor.css', + './@embroider/virtual/vendor.css', + ]; if (!candidates.includes(request.specifier)) { return request; @@ -1029,7 +1033,11 @@ export class Resolver { private handleVendor(request: R): R { //TODO move the extra forwardslash handling out into the vite plugin - const candidates = ['@embroider/virtual/vendor.js', '/@embroider/virtual/vendor.js', './@embroider/virtual/vendor.js']; + const candidates = [ + '@embroider/virtual/vendor.js', + '/@embroider/virtual/vendor.js', + './@embroider/virtual/vendor.js', + ]; if (!candidates.includes(request.specifier)) { return request;