mirror of
https://github.com/withastro/astro.git
synced 2025-01-20 22:12:38 -05:00
[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(
|
||||||
|
|
|
@ -20,10 +20,10 @@ 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';`);
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ describe('Astro Scripts before-hydration', () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
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);
|
||||||
});
|
});
|
||||||
|
@ -66,7 +66,7 @@ describe('Astro Scripts before-hydration', () => {
|
||||||
|
|
||||||
before(async () => {
|
before(async () => {
|
||||||
fixture = await loadFixture({
|
fixture = await loadFixture({
|
||||||
root: './fixtures/before-hydration/'
|
root: './fixtures/before-hydration/',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -121,10 +121,10 @@ 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';`);
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
}
|
},
|
||||||
]
|
],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -171,5 +171,5 @@ describe('Astro Scripts before-hydration', () => {
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Reference in a new issue