[ci] format

This commit is contained in:
matthewp 2022-03-30 12:43:13 +00:00 committed by GitHub Actions
parent 13b271bc7d
commit 6a1a40eef8
14 changed files with 29 additions and 33 deletions

View file

@ -681,7 +681,7 @@ export interface AstroIntegration {
'astro:server:start'?: (options: { address: AddressInfo }) => void | Promise<void>;
'astro:server:done'?: () => void | Promise<void>;
'astro:build:start'?: (options: { buildConfig: BuildConfig }) => void | Promise<void>;
'astro:build:setup'?: (options: { vite: ViteConfigWithSSR, target: 'client' | 'server' }) => void;
'astro:build:setup'?: (options: { vite: ViteConfigWithSSR; target: 'client' | 'server' }) => void;
'astro:build:done'?: (options: { pages: { pathname: string }[]; dir: URL; routes: RouteData[] }) => void | Promise<void>;
};
}

View file

@ -21,7 +21,7 @@ export class App {
#encoder = new TextEncoder();
#logging: LogOptions = {
dest: consoleLogDestination,
level: 'info'
level: 'info',
};
constructor(manifest: Manifest) {

View file

@ -157,7 +157,7 @@ async function ssrBuild(opts: StaticBuildOptions, internals: BuildInternals, inp
server: viteConfig.server,
base: astroConfig.buildOptions.site ? new URL(astroConfig.buildOptions.site).pathname : '/',
ssr: viteConfig.ssr,
resolve: viteConfig.resolve
resolve: viteConfig.resolve,
} as ViteConfigWithSSR;
await runHookBuildSetup({ config: astroConfig, vite: viteBuildConfig, target: 'server' });

View file

@ -85,8 +85,8 @@ export async function createVite(commandConfig: ViteConfigWithSSR, { astroConfig
alias: {
// This is needed for Deno compatibility, as the non-browser version
// of this module depends on Node `crypto`
'randombytes': 'randombytes/browser'
}
randombytes: 'randombytes/browser',
},
},
// Note: SSR API is in beta (https://vitejs.dev/guide/ssr.html)
ssr: {

View file

@ -90,7 +90,7 @@ export function table(opts: LogOptions, columns: number[]) {
}
export function debug(...args: any[]) {
if('_astroGlobalDebug' in globalThis) {
if ('_astroGlobalDebug' in globalThis) {
(globalThis as any)._astroGlobalDebug(...args);
}
}
@ -105,7 +105,7 @@ function padStr(str: string, len: number) {
}
export let defaultLogLevel: LoggerLevel;
if(typeof process !== 'undefined') {
if (typeof process !== 'undefined') {
if (process.argv.includes('--verbose')) {
defaultLogLevel = 'debug';
} else if (process.argv.includes('--silent')) {

View file

@ -10,7 +10,6 @@ type ConsoleStream = Writable & {
fd: 1 | 2;
};
let lastMessage: string;
let lastMessageCount = 1;
export const nodeLogDestination = new Writable({
@ -125,7 +124,6 @@ export const logger = {
error: error.bind(null, nodeLogOptions),
};
export function enableVerboseLogging() {
//debugPackage.enable('*,-babel');
debug('cli', '--verbose flag enabled! Enabling: DEBUG="*,-babel"');

View file

@ -1,4 +1,3 @@
// Vendored from https://github.com/genmon/aboutfeeds/blob/main/tools/pretty-feed-v3.xsl
/** Basic stylesheet for RSS feeds */
export const PRETTY_FEED_V3 = `<?xml version="1.0" encoding="utf-8"?>

View file

@ -92,7 +92,7 @@ export async function runHookBuildStart({ config, buildConfig }: { config: Astro
}
}
export async function runHookBuildSetup({ config, vite, target }: { config: AstroConfig, vite: ViteConfigWithSSR, target: 'server' | 'client' }) {
export async function runHookBuildSetup({ config, vite, target }: { config: AstroConfig; vite: ViteConfigWithSSR; target: 'server' | 'client' }) {
for (const integration of config.integrations) {
if (integration.hooks['astro:build:setup']) {
await integration.hooks['astro:build:setup']({ vite, target });

View file

@ -74,7 +74,7 @@ export async function loadFixture(inlineConfig) {
/** @type {import('../src/core/logger/core').LogOptions} */
const logging = {
dest: nodeLogDestination,
level: 'error'
level: 'error',
};
return {

View file

@ -10,7 +10,7 @@ export function getAdapter(args?: Options): AstroAdapter {
name: '@astrojs/deno',
serverEntrypoint: '@astrojs/deno/server.js',
args: args ?? {},
exports: ['stop', 'handle']
exports: ['stop', 'handle'],
};
}
@ -22,12 +22,12 @@ export default function createIntegration(args?: Options): AstroIntegration {
setAdapter(getAdapter(args));
},
'astro:build:setup': ({ vite, target }) => {
if(target === 'server') {
if (target === 'server') {
vite.ssr = {
noExternal: true
noExternal: true,
};
}
}
},
},
};
}

View file

@ -2,7 +2,7 @@ import './shim.js';
import type { SSRManifest } from 'astro';
import { App } from 'astro/app';
// @ts-ignore
import { Server } from "https://deno.land/std@0.132.0/http/server.ts";
import { Server } from 'https://deno.land/std@0.132.0/http/server.ts';
interface Options {
port?: number;
@ -14,7 +14,7 @@ let _server: Server | undefined = undefined;
let _startPromise: Promise<void> | undefined = undefined;
export function start(manifest: SSRManifest, options: Options) {
if(options.start === false) {
if (options.start === false) {
return;
}
@ -27,7 +27,7 @@ export function start(manifest: SSRManifest, options: Options) {
_server = new Server({
port: options.port ?? 8085,
hostname: options.hostname ?? "0.0.0.0",
hostname: options.hostname ?? '0.0.0.0',
handler,
//onError: options.onError,
});
@ -39,13 +39,13 @@ export function createExports(manifest: SSRManifest) {
const app = new App(manifest);
return {
async stop() {
if(_server) {
if (_server) {
_server.close();
}
await Promise.resolve(_startPromise);
},
async handle(request: Request) {
return app.render(request);
}
}
},
};
}

View file

@ -1,5 +1,4 @@
(globalThis as any).process = {
argv: [],
env: {}
env: {},
};

View file

@ -10,5 +10,5 @@ Deno.test({
const html = await resp.text();
assert(html);
});
}
},
});

View file

@ -4,7 +4,7 @@ const dir = new URL('./', import.meta.url);
export async function runBuild(fixturePath) {
let proc = Deno.run({
cmd: ['node', '../../../../../astro/astro.js', 'build', '--silent'],
cwd: fromFileUrl(new URL(fixturePath, dir))
cwd: fromFileUrl(new URL(fixturePath, dir)),
});
await proc.status();
return async () => await proc.close();