[ci] format

This commit is contained in:
matthewp 2022-09-15 16:36:38 +00:00 committed by fredkbot
parent 9a59e24e02
commit e40d8d8357
4 changed files with 36 additions and 36 deletions

View file

@ -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;

View file

@ -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();

View file

@ -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(

View file

@ -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', () => {
});
});
});
})
});
});