summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--packages/astro/src/core/app/index.ts2
-rw-r--r--packages/astro/src/runtime/server/astro-island.ts2
-rw-r--r--packages/astro/src/runtime/server/hydration.ts2
-rw-r--r--packages/astro/test/before-hydration.test.js66
4 files changed, 36 insertions, 36 deletions
diff --git a/packages/astro/src/core/app/index.ts b/packages/astro/src/core/app/index.ts
index f5ce5cd8b..413dba20c 100644
--- a/packages/astro/src/core/app/index.ts
+++ b/packages/astro/src/core/app/index.ts
@@ -159,7 +159,7 @@ export class App {
throw new Error(`Unable to resolve [${specifier}]`);
}
const bundlePath = manifest.entryModules[specifier];
- switch(true) {
+ switch (true) {
case bundlePath.startsWith('data:'):
case bundlePath.length === 0: {
return bundlePath;
diff --git a/packages/astro/src/runtime/server/astro-island.ts b/packages/astro/src/runtime/server/astro-island.ts
index 1c62b919d..894392524 100644
--- a/packages/astro/src/runtime/server/astro-island.ts
+++ b/packages/astro/src/runtime/server/astro-island.ts
@@ -57,7 +57,7 @@ declare const Astro: {
async childrenConnectedCallback() {
window.addEventListener('astro:hydrate', this.hydrate);
let beforeHydrationUrl = this.getAttribute('before-hydration-url');
- if(beforeHydrationUrl) {
+ if (beforeHydrationUrl) {
await import(beforeHydrationUrl);
}
this.start();
diff --git a/packages/astro/src/runtime/server/hydration.ts b/packages/astro/src/runtime/server/hydration.ts
index fdd01ce37..436e19f3c 100644
--- a/packages/astro/src/runtime/server/hydration.ts
+++ b/packages/astro/src/runtime/server/hydration.ts
@@ -152,7 +152,7 @@ export async function generateHydrateScript(
island.props['ssr'] = '';
island.props['client'] = hydrate;
let beforeHydrationUrl = await result.resolve('astro:scripts/before-hydration.js');
- if(beforeHydrationUrl.length) {
+ if (beforeHydrationUrl.length) {
island.props['before-hydration-url'] = beforeHydrationUrl;
}
island.props['opts'] = escapeHTML(
diff --git a/packages/astro/test/before-hydration.test.js b/packages/astro/test/before-hydration.test.js
index d8f8df3da..f429c31b3 100644
--- a/packages/astro/test/before-hydration.test.js
+++ b/packages/astro/test/before-hydration.test.js
@@ -9,7 +9,7 @@ describe('Astro Scripts before-hydration', () => {
describe('Is used by an integration', () => {
/** @type {import('./test-utils').Fixture} */
let fixture;
-
+
before(async () => {
fixture = await loadFixture({
root: './fixtures/before-hydration/',
@@ -20,25 +20,25 @@ describe('Astro Scripts before-hydration', () => {
hooks: {
'astro:config:setup'({ injectScript }) {
injectScript('before-hydration', `import '/src/scripts/global.js';`);
- }
- }
- }
- ]
+ },
+ },
+ },
+ ],
});
});
-
+
describe('Development', () => {
/** @type {import('./test-utils').DevServer} */
let devServer;
-
+
before(async () => {
devServer = await fixture.startDevServer();
});
-
+
after(async () => {
await devServer.stop();
});
-
+
it('Is included in the astro-island', async () => {
let res = await fixture.fetch('/');
let html = await res.text();
@@ -46,42 +46,42 @@ describe('Astro Scripts before-hydration', () => {
expect($('astro-island[before-hydration-url]')).has.a.lengthOf(1);
});
});
-
+
describe('Build', () => {
before(async () => {
await fixture.build();
});
-
+
it('Is included in the astro-island', async () => {
- let html = await fixture.readFile('/index.html')
+ let html = await fixture.readFile('/index.html');
let $ = cheerio.load(html);
expect($('astro-island[before-hydration-url]')).has.a.lengthOf(1);
});
});
});
-
+
describe('Is not used by an integration', () => {
/** @type {import('./test-utils').Fixture} */
let fixture;
-
+
before(async () => {
fixture = await loadFixture({
- root: './fixtures/before-hydration/'
+ root: './fixtures/before-hydration/',
});
});
-
+
describe('Development', () => {
/** @type {import('./test-utils').DevServer} */
let devServer;
-
+
before(async () => {
devServer = await fixture.startDevServer();
});
-
+
after(async () => {
await devServer.stop();
});
-
+
it('Does include before-hydration-url on the astro-island', async () => {
let res = await fixture.fetch('/');
let html = await res.text();
@@ -89,12 +89,12 @@ describe('Astro Scripts before-hydration', () => {
expect($('astro-island[before-hydration-url]')).has.a.lengthOf(1);
});
});
-
+
describe('Build', () => {
before(async () => {
await fixture.build();
});
-
+
it('Does not include before-hydration-url on the astro-island', async () => {
let html = await fixture.readFile('/index.html');
let $ = cheerio.load(html);
@@ -108,7 +108,7 @@ describe('Astro Scripts before-hydration', () => {
describe('Is used by an integration', () => {
/** @type {import('./test-utils').Fixture} */
let fixture;
-
+
before(async () => {
fixture = await loadFixture({
root: './fixtures/before-hydration/',
@@ -121,18 +121,18 @@ describe('Astro Scripts before-hydration', () => {
hooks: {
'astro:config:setup'({ injectScript }) {
injectScript('before-hydration', `import '/src/scripts/global.js';`);
- }
- }
- }
- ]
+ },
+ },
+ },
+ ],
});
});
-
+
describe('Prod', () => {
before(async () => {
await fixture.build();
});
-
+
it('Is included in the astro-island', async () => {
let app = await fixture.loadTestAdapterApp();
let request = new Request('http://example.com/');
@@ -143,11 +143,11 @@ describe('Astro Scripts before-hydration', () => {
});
});
});
-
+
describe('Is not used by an integration', () => {
/** @type {import('./test-utils').Fixture} */
let fixture;
-
+
before(async () => {
fixture = await loadFixture({
root: './fixtures/before-hydration/',
@@ -155,12 +155,12 @@ describe('Astro Scripts before-hydration', () => {
adapter: testAdapter(),
});
});
-
+
describe('Build', () => {
before(async () => {
await fixture.build();
});
-
+
it('Does not include before-hydration-url on the astro-island', async () => {
let app = await fixture.loadTestAdapterApp();
let request = new Request('http://example.com/');
@@ -171,5 +171,5 @@ describe('Astro Scripts before-hydration', () => {
});
});
});
- })
+ });
});