From 6a1a40eef8dc034c9e368fa4471620306d4286fd Mon Sep 17 00:00:00 2001 From: matthewp Date: Wed, 30 Mar 2022 12:43:13 +0000 Subject: [PATCH] [ci] format --- packages/astro/src/@types/astro.ts | 2 +- packages/astro/src/core/app/index.ts | 2 +- packages/astro/src/core/build/static-build.ts | 2 +- packages/astro/src/core/create-vite.ts | 4 ++-- packages/astro/src/core/logger/core.ts | 6 ++--- packages/astro/src/core/logger/node.ts | 2 -- packages/astro/src/core/render/pretty-feed.ts | 1 - packages/astro/src/integrations/index.ts | 2 +- packages/astro/test/test-utils.js | 2 +- packages/integrations/deno/src/index.ts | 8 +++---- packages/integrations/deno/src/server.ts | 24 +++++++++---------- packages/integrations/deno/src/shim.ts | 3 +-- .../integrations/deno/test/basics.test.js | 2 +- packages/integrations/deno/test/helpers.js | 2 +- 14 files changed, 29 insertions(+), 33 deletions(-) diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index 729add93c..33b03a775 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -681,7 +681,7 @@ export interface AstroIntegration { 'astro:server:start'?: (options: { address: AddressInfo }) => void | Promise; 'astro:server:done'?: () => void | Promise; 'astro:build:start'?: (options: { buildConfig: BuildConfig }) => void | Promise; - '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; }; } diff --git a/packages/astro/src/core/app/index.ts b/packages/astro/src/core/app/index.ts index a5d32b2ad..ee66df9d1 100644 --- a/packages/astro/src/core/app/index.ts +++ b/packages/astro/src/core/app/index.ts @@ -21,7 +21,7 @@ export class App { #encoder = new TextEncoder(); #logging: LogOptions = { dest: consoleLogDestination, - level: 'info' + level: 'info', }; constructor(manifest: Manifest) { diff --git a/packages/astro/src/core/build/static-build.ts b/packages/astro/src/core/build/static-build.ts index a7117104e..481d51cfa 100644 --- a/packages/astro/src/core/build/static-build.ts +++ b/packages/astro/src/core/build/static-build.ts @@ -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' }); diff --git a/packages/astro/src/core/create-vite.ts b/packages/astro/src/core/create-vite.ts index 9ef99ccc1..8564290e2 100644 --- a/packages/astro/src/core/create-vite.ts +++ b/packages/astro/src/core/create-vite.ts @@ -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: { diff --git a/packages/astro/src/core/logger/core.ts b/packages/astro/src/core/logger/core.ts index 1fc3a7447..0ac93e59b 100644 --- a/packages/astro/src/core/logger/core.ts +++ b/packages/astro/src/core/logger/core.ts @@ -1,5 +1,5 @@ import type { AstroConfig } from '../../@types/astro'; -import { bold, dim } from 'kleur/colors'; +import { bold, dim } from 'kleur/colors'; import stringWidth from 'string-width'; interface LogWritable { @@ -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')) { diff --git a/packages/astro/src/core/logger/node.ts b/packages/astro/src/core/logger/node.ts index 229a9f616..f83483859 100644 --- a/packages/astro/src/core/logger/node.ts +++ b/packages/astro/src/core/logger/node.ts @@ -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"'); diff --git a/packages/astro/src/core/render/pretty-feed.ts b/packages/astro/src/core/render/pretty-feed.ts index 05e5540e5..ed3168fec 100644 --- a/packages/astro/src/core/render/pretty-feed.ts +++ b/packages/astro/src/core/render/pretty-feed.ts @@ -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 = ` diff --git a/packages/astro/src/integrations/index.ts b/packages/astro/src/integrations/index.ts index daaa3145f..93176a6bf 100644 --- a/packages/astro/src/integrations/index.ts +++ b/packages/astro/src/integrations/index.ts @@ -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 }); diff --git a/packages/astro/test/test-utils.js b/packages/astro/test/test-utils.js index 56a768ed2..56c18580b 100644 --- a/packages/astro/test/test-utils.js +++ b/packages/astro/test/test-utils.js @@ -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 { diff --git a/packages/integrations/deno/src/index.ts b/packages/integrations/deno/src/index.ts index c6f6207a5..ad5462112 100644 --- a/packages/integrations/deno/src/index.ts +++ b/packages/integrations/deno/src/index.ts @@ -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, }; } - } + }, }, }; } diff --git a/packages/integrations/deno/src/server.ts b/packages/integrations/deno/src/server.ts index 8e7ecf17d..e1659a843 100644 --- a/packages/integrations/deno/src/server.ts +++ b/packages/integrations/deno/src/server.ts @@ -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 | undefined = undefined; export function start(manifest: SSRManifest, options: Options) { - if(options.start === false) { + if (options.start === false) { return; } @@ -26,26 +26,26 @@ export function start(manifest: SSRManifest, options: Options) { }; _server = new Server({ - port: options.port ?? 8085, - hostname: options.hostname ?? "0.0.0.0", - handler, - //onError: options.onError, - }); + port: options.port ?? 8085, + hostname: options.hostname ?? '0.0.0.0', + handler, + //onError: options.onError, + }); - _startPromise = _server.listenAndServe(); + _startPromise = _server.listenAndServe(); } export function createExports(manifest: SSRManifest) { const app = new App(manifest); return { async stop() { - if(_server) { - _server.close(); + if (_server) { + _server.close(); } await Promise.resolve(_startPromise); }, async handle(request: Request) { return app.render(request); - } - } + }, + }; } diff --git a/packages/integrations/deno/src/shim.ts b/packages/integrations/deno/src/shim.ts index 11c1c912b..1a4a6ee9b 100644 --- a/packages/integrations/deno/src/shim.ts +++ b/packages/integrations/deno/src/shim.ts @@ -1,5 +1,4 @@ - (globalThis as any).process = { argv: [], - env: {} + env: {}, }; diff --git a/packages/integrations/deno/test/basics.test.js b/packages/integrations/deno/test/basics.test.js index 93e0d5625..6f152d4f4 100644 --- a/packages/integrations/deno/test/basics.test.js +++ b/packages/integrations/deno/test/basics.test.js @@ -10,5 +10,5 @@ Deno.test({ const html = await resp.text(); assert(html); }); - } + }, }); diff --git a/packages/integrations/deno/test/helpers.js b/packages/integrations/deno/test/helpers.js index df4f7c934..659d24d5e 100644 --- a/packages/integrations/deno/test/helpers.js +++ b/packages/integrations/deno/test/helpers.js @@ -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();