[ci] yarn format
This commit is contained in:
parent
2aa5ba5c52
commit
365972582e
3 changed files with 25 additions and 27 deletions
|
@ -5,19 +5,19 @@ import npath from 'path';
|
||||||
import { fileURLToPath } from 'url';
|
import { fileURLToPath } from 'url';
|
||||||
|
|
||||||
export function emptyDir(dir: string, skip?: Set<string>): void {
|
export function emptyDir(dir: string, skip?: Set<string>): void {
|
||||||
for (const file of fs.readdirSync(dir)) {
|
for (const file of fs.readdirSync(dir)) {
|
||||||
if (skip?.has(file)) {
|
if (skip?.has(file)) {
|
||||||
continue
|
continue;
|
||||||
}
|
}
|
||||||
const abs = npath.resolve(dir, file)
|
const abs = npath.resolve(dir, file);
|
||||||
// baseline is Node 12 so can't use rmSync :(
|
// baseline is Node 12 so can't use rmSync :(
|
||||||
if (fs.lstatSync(abs).isDirectory()) {
|
if (fs.lstatSync(abs).isDirectory()) {
|
||||||
emptyDir(abs)
|
emptyDir(abs);
|
||||||
fs.rmdirSync(abs)
|
fs.rmdirSync(abs);
|
||||||
} else {
|
} else {
|
||||||
fs.unlinkSync(abs)
|
fs.unlinkSync(abs);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export function prepareOutDir(astroConfig: AstroConfig) {
|
export function prepareOutDir(astroConfig: AstroConfig) {
|
||||||
|
|
|
@ -36,8 +36,6 @@ function addPageName(pathname: string, opts: StaticBuildOptions): void {
|
||||||
opts.pageNames.push(pathname.replace(/\/?$/, pathrepl).replace(/^\//, ''));
|
opts.pageNames.push(pathname.replace(/\/?$/, pathrepl).replace(/^\//, ''));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// Determines of a Rollup chunk is an entrypoint page.
|
// Determines of a Rollup chunk is an entrypoint page.
|
||||||
function chunkIsPage(output: OutputAsset | OutputChunk, internals: BuildInternals) {
|
function chunkIsPage(output: OutputAsset | OutputChunk, internals: BuildInternals) {
|
||||||
if (output.type !== 'chunk') {
|
if (output.type !== 'chunk') {
|
||||||
|
@ -178,14 +176,16 @@ async function collectRenderers(opts: StaticBuildOptions): Promise<Renderer[]> {
|
||||||
// we need the ESM loaded version. This creates that.
|
// we need the ESM loaded version. This creates that.
|
||||||
const viteLoadedRenderers = pageData.preload[0];
|
const viteLoadedRenderers = pageData.preload[0];
|
||||||
|
|
||||||
const renderers = await Promise.all(viteLoadedRenderers.map(async r => {
|
const renderers = await Promise.all(
|
||||||
const mod = await import(r.serverEntry);
|
viteLoadedRenderers.map(async (r) => {
|
||||||
return Object.create(r, {
|
const mod = await import(r.serverEntry);
|
||||||
ssr: {
|
return Object.create(r, {
|
||||||
value: mod.default
|
ssr: {
|
||||||
}
|
value: mod.default,
|
||||||
}) as Renderer;
|
},
|
||||||
}));
|
}) as Renderer;
|
||||||
|
})
|
||||||
|
);
|
||||||
|
|
||||||
return renderers;
|
return renderers;
|
||||||
}
|
}
|
||||||
|
@ -253,7 +253,7 @@ async function generatePath(pathname: string, opts: StaticBuildOptions, gopts: G
|
||||||
// This adds the page name to the array so it can be shown as part of stats.
|
// This adds the page name to the array so it can be shown as part of stats.
|
||||||
addPageName(pathname, opts);
|
addPageName(pathname, opts);
|
||||||
|
|
||||||
const [,mod] = pageData.preload;
|
const [, mod] = pageData.preload;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const [params, pageProps] = await getParamsAndProps({
|
const [params, pageProps] = await getParamsAndProps({
|
||||||
|
|
|
@ -12,9 +12,7 @@ describe('Static build - frameworks', () => {
|
||||||
before(async () => {
|
before(async () => {
|
||||||
fixture = await loadFixture({
|
fixture = await loadFixture({
|
||||||
projectRoot: './fixtures/static-build-frameworks/',
|
projectRoot: './fixtures/static-build-frameworks/',
|
||||||
renderers: [
|
renderers: ['@astrojs/renderer-preact'],
|
||||||
'@astrojs/renderer-preact'
|
|
||||||
],
|
|
||||||
buildOptions: {
|
buildOptions: {
|
||||||
experimentalStaticBuild: true,
|
experimentalStaticBuild: true,
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue