summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar natemoo-re <natemoo-re@users.noreply.github.com> 2023-01-23 18:05:25 +0000
committerGravatar fredkbot <fred+astrobot@astro.build> 2023-01-23 18:05:25 +0000
commit12a10fe7c535aa33f5af743fdb57c9ee32808bb6 (patch)
treecf4d18ccd3d4b5360a899d622c9df134a68a69db
parent7325df412107fc0e65cd45c1b568fb686708f723 (diff)
downloadastro-12a10fe7c535aa33f5af743fdb57c9ee32808bb6.tar.gz
astro-12a10fe7c535aa33f5af743fdb57c9ee32808bb6.tar.zst
astro-12a10fe7c535aa33f5af743fdb57c9ee32808bb6.zip
[ci] format
-rw-r--r--packages/astro/e2e/css-sourcemaps.test.js4
-rw-r--r--packages/astro/e2e/css.test.js4
-rw-r--r--packages/astro/src/core/render/dev/index.ts2
-rw-r--r--packages/astro/src/runtime/client/hmr.ts6
4 files changed, 10 insertions, 6 deletions
diff --git a/packages/astro/e2e/css-sourcemaps.test.js b/packages/astro/e2e/css-sourcemaps.test.js
index 07cea4cb0..919d3c864 100644
--- a/packages/astro/e2e/css-sourcemaps.test.js
+++ b/packages/astro/e2e/css-sourcemaps.test.js
@@ -19,8 +19,8 @@ test.describe('CSS Sourcemap HMR', () => {
test.skip(isWindows, 'TODO: fix css hmr in windows');
test('removes Astro-injected CSS once Vite-injected CSS loads', async ({ page, astro }) => {
- const html = await astro.fetch('/').then(res => res.text());
-
+ const html = await astro.fetch('/').then((res) => res.text());
+
// style[data-astro-dev-id] should exist in initial SSR'd markup
expect(html).toMatch('data-astro-dev-id');
diff --git a/packages/astro/e2e/css.test.js b/packages/astro/e2e/css.test.js
index 745a540ee..7c2527499 100644
--- a/packages/astro/e2e/css.test.js
+++ b/packages/astro/e2e/css.test.js
@@ -32,8 +32,8 @@ test.describe('CSS HMR', () => {
});
test('removes Astro-injected CSS once Vite-injected CSS loads', async ({ page, astro }) => {
- const html = await astro.fetch('/').then(res => res.text());
-
+ const html = await astro.fetch('/').then((res) => res.text());
+
// style[data-astro-dev-id] should exist in initial SSR'd markup
expect(html).toMatch('data-astro-dev-id');
diff --git a/packages/astro/src/core/render/dev/index.ts b/packages/astro/src/core/render/dev/index.ts
index 7ea008d69..92d374d3e 100644
--- a/packages/astro/src/core/render/dev/index.ts
+++ b/packages/astro/src/core/render/dev/index.ts
@@ -136,7 +136,7 @@ async function getScriptsAndStyles({ env, filePath }: GetScriptsAndStylesParams)
props: {
type: 'text/css',
// Track the ID so we can match it to Vite's injected style later
- 'data-astro-dev-id': viteID(new URL(`.${url}`, env.settings.config.root))
+ 'data-astro-dev-id': viteID(new URL(`.${url}`, env.settings.config.root)),
},
children: content,
});
diff --git a/packages/astro/src/runtime/client/hmr.ts b/packages/astro/src/runtime/client/hmr.ts
index b71c39990..b4c6acb88 100644
--- a/packages/astro/src/runtime/client/hmr.ts
+++ b/packages/astro/src/runtime/client/hmr.ts
@@ -42,5 +42,9 @@ function isStyle(node: Node): node is HTMLStyleElement {
}
function isViteInjectedStyle(node: Node): node is HTMLStyleElement {
- return isStyle(node) && node.getAttribute('type') === 'text/css' && !!node.getAttribute('data-vite-dev-id');
+ return (
+ isStyle(node) &&
+ node.getAttribute('type') === 'text/css' &&
+ !!node.getAttribute('data-vite-dev-id')
+ );
}