[ci] format

This commit is contained in:
FredKSchott 2022-07-25 04:20:38 +00:00 committed by fredkbot
parent cd4be4822c
commit d2148ce982
17 changed files with 78 additions and 74 deletions

View file

@ -132,7 +132,12 @@ async function runCommand(cmd: string, flags: yargs.Arguments) {
}
}
let { astroConfig, userConfig, userConfigPath } = await openConfig({ cwd: root, flags, cmd, logging });
let { astroConfig, userConfig, userConfigPath } = await openConfig({
cwd: root,
flags,
cmd,
logging,
});
telemetry.record(event.eventCliSession(cmd, userConfig, flags));
// Common CLI Commands:

View file

@ -1,11 +1,5 @@
import type { AstroTelemetry } from '@astrojs/telemetry';
import type {
AstroAdapter,
AstroConfig,
BuildConfig,
ManifestData,
RuntimeMode,
} from '../../@types/astro';
import type { AstroConfig, BuildConfig, ManifestData, RuntimeMode } from '../../@types/astro';
import type { LogOptions } from '../logger/core';
import fs from 'fs';

View file

@ -6,7 +6,7 @@ import { fileURLToPath } from 'url';
import * as vite from 'vite';
import { BuildInternals, createBuildInternals } from '../../core/build/internal.js';
import { prependForwardSlash } from '../../core/path.js';
import { emptyDir, removeDir, isModeServerWithNoAdapter } from '../../core/util.js';
import { emptyDir, isModeServerWithNoAdapter, removeDir } from '../../core/util.js';
import { runHookBuildSetup } from '../../integrations/index.js';
import { rollupPluginAstroBuildCSS } from '../../vite-plugin-build-css/index.js';
import type { ViteConfigWithSSR } from '../create-vite';
@ -36,7 +36,7 @@ Example:
output: 'server',
adapter: netlify(),
}
`)
`);
}
// The pages to be built for rendering purposes.
@ -71,11 +71,7 @@ Example:
// Build your project (SSR application code, assets, client JS, etc.)
timer.ssr = performance.now();
info(
opts.logging,
'build',
`Building ${astroConfig.output} entrypoints...`
);
info(opts.logging, 'build', `Building ${astroConfig.output} entrypoints...`);
const ssrResult = (await ssrBuild(opts, internals, pageInput)) as RollupOutput;
info(opts.logging, 'build', dim(`Completed in ${getTimeStat(timer.ssr, performance.now())}.`));
@ -156,7 +152,8 @@ async function ssrBuild(opts: StaticBuildOptions, internals: BuildInternals, inp
}),
...(viteConfig.plugins || []),
// SSR needs to be last
opts.astroConfig.output === 'server' && vitePluginSSR(internals, opts.astroConfig._ctx.adapter!),
opts.astroConfig.output === 'server' &&
vitePluginSSR(internals, opts.astroConfig._ctx.adapter!),
vitePluginAnalyzer(opts.astroConfig, internals),
],
publicDir: ssr ? false : viteConfig.publicDir,
@ -287,9 +284,8 @@ async function copyFiles(fromFolder: URL, toFolder: URL) {
async function ssrMoveAssets(opts: StaticBuildOptions) {
info(opts.logging, 'build', 'Rearranging server assets...');
const serverRoot = opts.astroConfig.output === 'static'
? opts.buildConfig.client
: opts.buildConfig.server;
const serverRoot =
opts.astroConfig.output === 'static' ? opts.buildConfig.client : opts.buildConfig.server;
const clientRoot = opts.buildConfig.client;
const serverAssets = new URL('./assets/', serverRoot);
const clientAssets = new URL('./assets/', clientRoot);

View file

@ -13,9 +13,9 @@ import { BUNDLED_THEMES } from 'shiki';
import { fileURLToPath, pathToFileURL } from 'url';
import { mergeConfig as mergeViteConfig } from 'vite';
import { z } from 'zod';
import { LogOptions } from './logger/core.js';
import { appendForwardSlash, prependForwardSlash, trimSlashes } from './path.js';
import { arraify, isObject } from './util.js';
import { LogOptions, warn } from './logger/core.js';
load.use([loadTypeScript]);

View file

@ -38,9 +38,8 @@ describe('AstroConfig - config.mode', () => {
fixture = await loadFixture({
// This is just a random fixture to test, doesn't matter.
root: './fixtures/astro-basic/',
output: 'server'
output: 'server',
});
});
it('Throws during the build', async () => {
@ -67,7 +66,7 @@ describe('AstroConfig - config.mode', () => {
fixture = await loadFixture({
// This is just a random fixture to test, doesn't matter.
root: './fixtures/astro-basic/',
output: 'static'
output: 'static',
});
await fixture.build();
});
@ -92,7 +91,7 @@ describe('AstroConfig - config.mode', () => {
// This is just a random fixture to test, doesn't matter.
root: './fixtures/astro-basic/',
adapter: testAdapter(),
output: 'server'
output: 'server',
});
await fixture.build();
});

View file

@ -11,7 +11,7 @@ describe('Using the Partytown integration in SSR', () => {
fixture = await loadFixture({
root: './fixtures/ssr-partytown/',
adapter: testAdapter(),
output: 'server'
output: 'server',
});
await fixture.build();
});

View file

@ -11,7 +11,7 @@ describe('Using Astro.request in SSR', () => {
fixture = await loadFixture({
root: './fixtures/ssr-request/',
adapter: testAdapter(),
output: 'server'
output: 'server',
});
await fixture.build();
});

View file

@ -11,7 +11,7 @@ describe('Using Astro.response in SSR', () => {
fixture = await loadFixture({
root: './fixtures/ssr-response/',
adapter: testAdapter(),
output: 'server'
output: 'server',
});
await fixture.build();
});

View file

@ -13,7 +13,7 @@ describe('Streaming', () => {
fixture = await loadFixture({
root: './fixtures/streaming/',
adapter: testAdapter(),
output: 'server'
output: 'server',
});
});

View file

@ -23,8 +23,12 @@ export default function createIntegration(): AstroIntegration {
_config = config;
if (config.output === 'static') {
console.warn(`[@astrojs/cloudflare] \`output: "server"\` is required to use this adapter.`);
console.warn(`[@astrojs/cloudflare] Otherwise, this adapter is not required to deploy a static site to Cloudflare.`);
console.warn(
`[@astrojs/cloudflare] \`output: "server"\` is required to use this adapter.`
);
console.warn(
`[@astrojs/cloudflare] Otherwise, this adapter is not required to deploy a static site to Cloudflare.`
);
}
},
'astro:build:start': ({ buildConfig }) => {

View file

@ -34,7 +34,9 @@ export default function createIntegration(args?: Options): AstroIntegration {
if (config.output === 'static') {
console.warn(`[@astrojs/deno] \`output: "server"\` is required to use this adapter.`);
console.warn(`[@astrojs/deno] Otherwise, this adapter is not required to deploy a static site to Deno.`);
console.warn(
`[@astrojs/deno] Otherwise, this adapter is not required to deploy a static site to Deno.`
);
}
},
'astro:build:start': ({ buildConfig }) => {

View file

@ -138,7 +138,9 @@ export function netlifyEdgeFunctions({ dist }: NetlifyEdgeFunctionsOptions = {})
if (config.output === 'static') {
console.warn(`[@astrojs/netlify] \`output: "server"\` is required to use this adapter.`);
console.warn(`[@astrojs/netlify] Otherwise, this adapter is not required to deploy a static site to Netlify.`);
console.warn(
`[@astrojs/netlify] Otherwise, this adapter is not required to deploy a static site to Netlify.`
);
}
},
'astro:build:start': async ({ buildConfig }) => {

View file

@ -38,7 +38,9 @@ function netlifyFunctions({
if (config.output === 'static') {
console.warn(`[@astrojs/netlify] \`output: "server"\` is required to use this adapter.`);
console.warn(`[@astrojs/netlify] Otherwise, this adapter is not required to deploy a static site to Netlify.`);
console.warn(
`[@astrojs/netlify] Otherwise, this adapter is not required to deploy a static site to Netlify.`
);
}
},
'astro:build:start': async ({ buildConfig }) => {

View file

@ -1,5 +1,5 @@
export { pathToPosix } from './lib/utils';
export { AbortController, AbortSignal, alert, atob, Blob, btoa, ByteLengthQueuingStrategy, cancelAnimationFrame, cancelIdleCallback, CanvasRenderingContext2D, CharacterData, clearTimeout, Comment, CountQueuingStrategy, CSSStyleSheet, CustomElementRegistry, CustomEvent, Document, DocumentFragment, DOMException, Element, Event, EventTarget, fetch, File, FormData, Headers, HTMLBodyElement, HTMLCanvasElement, HTMLDivElement, HTMLDocument, HTMLElement, HTMLHeadElement, HTMLHtmlElement, HTMLImageElement, HTMLSpanElement, HTMLStyleElement, HTMLTemplateElement, HTMLUnknownElement, Image, ImageData, IntersectionObserver, MediaQueryList, MutationObserver, Node, NodeFilter, NodeIterator, OffscreenCanvas, ReadableByteStreamController, ReadableStream, ReadableStreamBYOBReader, ReadableStreamBYOBRequest, ReadableStreamDefaultController, ReadableStreamDefaultReader, Request, requestAnimationFrame, requestIdleCallback, ResizeObserver, Response, setTimeout, ShadowRoot, structuredClone, StyleSheet, Text, TransformStream, TreeWalker, URLPattern, Window, WritableStream, WritableStreamDefaultController, WritableStreamDefaultWriter, } from './mod.js';
export { AbortController, AbortSignal, alert, atob, Blob, btoa, ByteLengthQueuingStrategy, cancelAnimationFrame, cancelIdleCallback, CanvasRenderingContext2D, CharacterData, clearTimeout, Comment, CountQueuingStrategy, CSSStyleSheet, CustomElementRegistry, CustomEvent, Document, DocumentFragment, DOMException, Element, Event, EventTarget, fetch, File, FormData, Headers, HTMLBodyElement, HTMLCanvasElement, HTMLDivElement, HTMLDocument, HTMLElement, HTMLHeadElement, HTMLHtmlElement, HTMLImageElement, HTMLSpanElement, HTMLStyleElement, HTMLTemplateElement, HTMLUnknownElement, Image, ImageData, IntersectionObserver, MediaQueryList, MutationObserver, Node, NodeFilter, NodeIterator, OffscreenCanvas, ReadableByteStreamController, ReadableStream, ReadableStreamBYOBReader, ReadableStreamBYOBRequest, ReadableStreamDefaultController, ReadableStreamDefaultReader, Request, requestAnimationFrame, requestIdleCallback, ResizeObserver, Response, setTimeout, ShadowRoot, structuredClone, StyleSheet, Text, TransformStream, TreeWalker, URLPattern, Window, WritableStream, WritableStreamDefaultController, WritableStreamDefaultWriter } from './mod.js';
export declare const polyfill: {
(target: any, options?: PolyfillOptions): any;
internals(target: any, name: string): any;