[ci] format
This commit is contained in:
parent
9a59e24e02
commit
e40d8d8357
4 changed files with 36 additions and 36 deletions
|
@ -159,7 +159,7 @@ export class App {
|
||||||
throw new Error(`Unable to resolve [${specifier}]`);
|
throw new Error(`Unable to resolve [${specifier}]`);
|
||||||
}
|
}
|
||||||
const bundlePath = manifest.entryModules[specifier];
|
const bundlePath = manifest.entryModules[specifier];
|
||||||
switch(true) {
|
switch (true) {
|
||||||
case bundlePath.startsWith('data:'):
|
case bundlePath.startsWith('data:'):
|
||||||
case bundlePath.length === 0: {
|
case bundlePath.length === 0: {
|
||||||
return bundlePath;
|
return bundlePath;
|
||||||
|
|
|
@ -57,7 +57,7 @@ declare const Astro: {
|
||||||
async childrenConnectedCallback() {
|
async childrenConnectedCallback() {
|
||||||
window.addEventListener('astro:hydrate', this.hydrate);
|
window.addEventListener('astro:hydrate', this.hydrate);
|
||||||
let beforeHydrationUrl = this.getAttribute('before-hydration-url');
|
let beforeHydrationUrl = this.getAttribute('before-hydration-url');
|
||||||
if(beforeHydrationUrl) {
|
if (beforeHydrationUrl) {
|
||||||
await import(beforeHydrationUrl);
|
await import(beforeHydrationUrl);
|
||||||
}
|
}
|
||||||
this.start();
|
this.start();
|
||||||
|
|
|
@ -152,7 +152,7 @@ export async function generateHydrateScript(
|
||||||
island.props['ssr'] = '';
|
island.props['ssr'] = '';
|
||||||
island.props['client'] = hydrate;
|
island.props['client'] = hydrate;
|
||||||
let beforeHydrationUrl = await result.resolve('astro:scripts/before-hydration.js');
|
let beforeHydrationUrl = await result.resolve('astro:scripts/before-hydration.js');
|
||||||
if(beforeHydrationUrl.length) {
|
if (beforeHydrationUrl.length) {
|
||||||
island.props['before-hydration-url'] = beforeHydrationUrl;
|
island.props['before-hydration-url'] = beforeHydrationUrl;
|
||||||
}
|
}
|
||||||
island.props['opts'] = escapeHTML(
|
island.props['opts'] = escapeHTML(
|
||||||
|
|
|
@ -9,7 +9,7 @@ describe('Astro Scripts before-hydration', () => {
|
||||||
describe('Is used by an integration', () => {
|
describe('Is used by an integration', () => {
|
||||||
/** @type {import('./test-utils').Fixture} */
|
/** @type {import('./test-utils').Fixture} */
|
||||||
let fixture;
|
let fixture;
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
fixture = await loadFixture({
|
fixture = await loadFixture({
|
||||||
root: './fixtures/before-hydration/',
|
root: './fixtures/before-hydration/',
|
||||||
|
@ -20,25 +20,25 @@ describe('Astro Scripts before-hydration', () => {
|
||||||
hooks: {
|
hooks: {
|
||||||
'astro:config:setup'({ injectScript }) {
|
'astro:config:setup'({ injectScript }) {
|
||||||
injectScript('before-hydration', `import '/src/scripts/global.js';`);
|
injectScript('before-hydration', `import '/src/scripts/global.js';`);
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Development', () => {
|
describe('Development', () => {
|
||||||
/** @type {import('./test-utils').DevServer} */
|
/** @type {import('./test-utils').DevServer} */
|
||||||
let devServer;
|
let devServer;
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
devServer = await fixture.startDevServer();
|
devServer = await fixture.startDevServer();
|
||||||
});
|
});
|
||||||
|
|
||||||
after(async () => {
|
after(async () => {
|
||||||
await devServer.stop();
|
await devServer.stop();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Is included in the astro-island', async () => {
|
it('Is included in the astro-island', async () => {
|
||||||
let res = await fixture.fetch('/');
|
let res = await fixture.fetch('/');
|
||||||
let html = await res.text();
|
let html = await res.text();
|
||||||
|
@ -46,42 +46,42 @@ describe('Astro Scripts before-hydration', () => {
|
||||||
expect($('astro-island[before-hydration-url]')).has.a.lengthOf(1);
|
expect($('astro-island[before-hydration-url]')).has.a.lengthOf(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Build', () => {
|
describe('Build', () => {
|
||||||
before(async () => {
|
before(async () => {
|
||||||
await fixture.build();
|
await fixture.build();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Is included in the astro-island', async () => {
|
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);
|
let $ = cheerio.load(html);
|
||||||
expect($('astro-island[before-hydration-url]')).has.a.lengthOf(1);
|
expect($('astro-island[before-hydration-url]')).has.a.lengthOf(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Is not used by an integration', () => {
|
describe('Is not used by an integration', () => {
|
||||||
/** @type {import('./test-utils').Fixture} */
|
/** @type {import('./test-utils').Fixture} */
|
||||||
let fixture;
|
let fixture;
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
fixture = await loadFixture({
|
fixture = await loadFixture({
|
||||||
root: './fixtures/before-hydration/'
|
root: './fixtures/before-hydration/',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Development', () => {
|
describe('Development', () => {
|
||||||
/** @type {import('./test-utils').DevServer} */
|
/** @type {import('./test-utils').DevServer} */
|
||||||
let devServer;
|
let devServer;
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
devServer = await fixture.startDevServer();
|
devServer = await fixture.startDevServer();
|
||||||
});
|
});
|
||||||
|
|
||||||
after(async () => {
|
after(async () => {
|
||||||
await devServer.stop();
|
await devServer.stop();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Does include before-hydration-url on the astro-island', async () => {
|
it('Does include before-hydration-url on the astro-island', async () => {
|
||||||
let res = await fixture.fetch('/');
|
let res = await fixture.fetch('/');
|
||||||
let html = await res.text();
|
let html = await res.text();
|
||||||
|
@ -89,12 +89,12 @@ describe('Astro Scripts before-hydration', () => {
|
||||||
expect($('astro-island[before-hydration-url]')).has.a.lengthOf(1);
|
expect($('astro-island[before-hydration-url]')).has.a.lengthOf(1);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Build', () => {
|
describe('Build', () => {
|
||||||
before(async () => {
|
before(async () => {
|
||||||
await fixture.build();
|
await fixture.build();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Does not include before-hydration-url on the astro-island', async () => {
|
it('Does not include before-hydration-url on the astro-island', async () => {
|
||||||
let html = await fixture.readFile('/index.html');
|
let html = await fixture.readFile('/index.html');
|
||||||
let $ = cheerio.load(html);
|
let $ = cheerio.load(html);
|
||||||
|
@ -108,7 +108,7 @@ describe('Astro Scripts before-hydration', () => {
|
||||||
describe('Is used by an integration', () => {
|
describe('Is used by an integration', () => {
|
||||||
/** @type {import('./test-utils').Fixture} */
|
/** @type {import('./test-utils').Fixture} */
|
||||||
let fixture;
|
let fixture;
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
fixture = await loadFixture({
|
fixture = await loadFixture({
|
||||||
root: './fixtures/before-hydration/',
|
root: './fixtures/before-hydration/',
|
||||||
|
@ -121,18 +121,18 @@ describe('Astro Scripts before-hydration', () => {
|
||||||
hooks: {
|
hooks: {
|
||||||
'astro:config:setup'({ injectScript }) {
|
'astro:config:setup'({ injectScript }) {
|
||||||
injectScript('before-hydration', `import '/src/scripts/global.js';`);
|
injectScript('before-hydration', `import '/src/scripts/global.js';`);
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Prod', () => {
|
describe('Prod', () => {
|
||||||
before(async () => {
|
before(async () => {
|
||||||
await fixture.build();
|
await fixture.build();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Is included in the astro-island', async () => {
|
it('Is included in the astro-island', async () => {
|
||||||
let app = await fixture.loadTestAdapterApp();
|
let app = await fixture.loadTestAdapterApp();
|
||||||
let request = new Request('http://example.com/');
|
let request = new Request('http://example.com/');
|
||||||
|
@ -143,11 +143,11 @@ describe('Astro Scripts before-hydration', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Is not used by an integration', () => {
|
describe('Is not used by an integration', () => {
|
||||||
/** @type {import('./test-utils').Fixture} */
|
/** @type {import('./test-utils').Fixture} */
|
||||||
let fixture;
|
let fixture;
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
fixture = await loadFixture({
|
fixture = await loadFixture({
|
||||||
root: './fixtures/before-hydration/',
|
root: './fixtures/before-hydration/',
|
||||||
|
@ -155,12 +155,12 @@ describe('Astro Scripts before-hydration', () => {
|
||||||
adapter: testAdapter(),
|
adapter: testAdapter(),
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('Build', () => {
|
describe('Build', () => {
|
||||||
before(async () => {
|
before(async () => {
|
||||||
await fixture.build();
|
await fixture.build();
|
||||||
});
|
});
|
||||||
|
|
||||||
it('Does not include before-hydration-url on the astro-island', async () => {
|
it('Does not include before-hydration-url on the astro-island', async () => {
|
||||||
let app = await fixture.loadTestAdapterApp();
|
let app = await fixture.loadTestAdapterApp();
|
||||||
let request = new Request('http://example.com/');
|
let request = new Request('http://example.com/');
|
||||||
|
@ -171,5 +171,5 @@ describe('Astro Scripts before-hydration', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue