Skip to content

Commit

Permalink
[ci] format
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewp authored and actions-user committed Mar 30, 2022
1 parent 13b271b commit 6a1a40e
Show file tree
Hide file tree
Showing 14 changed files with 29 additions and 33 deletions.
2 changes: 1 addition & 1 deletion packages/astro/src/@types/astro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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>;
};
}
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/app/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class App {
#encoder = new TextEncoder();
#logging: LogOptions = {
dest: consoleLogDestination,
level: 'info'
level: 'info',
};

constructor(manifest: Manifest) {
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/build/static-build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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' });
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/core/create-vite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
6 changes: 3 additions & 3 deletions packages/astro/src/core/logger/core.ts
Original file line number Diff line number Diff line change
@@ -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<T> {
Expand Down Expand Up @@ -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);
}
}
Expand All @@ -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')) {
Expand Down
2 changes: 0 additions & 2 deletions packages/astro/src/core/logger/node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ type ConsoleStream = Writable & {
fd: 1 | 2;
};


let lastMessage: string;
let lastMessageCount = 1;
export const nodeLogDestination = new Writable({
Expand Down Expand Up @@ -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"');
Expand Down
1 change: 0 additions & 1 deletion packages/astro/src/core/render/pretty-feed.ts
Original file line number Diff line number Diff line change
@@ -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"?>
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/integrations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 });
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/test/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
8 changes: 4 additions & 4 deletions packages/integrations/deno/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
};
}

Expand All @@ -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,
};
}
}
},
},
};
}
24 changes: 12 additions & 12 deletions packages/integrations/deno/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]/http/server.ts";
import { Server } from 'https://deno.land/[email protected]/http/server.ts';

interface Options {
port?: number;
Expand All @@ -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;
}

Expand All @@ -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);
}
}
},
};
}
3 changes: 1 addition & 2 deletions packages/integrations/deno/src/shim.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@

(globalThis as any).process = {
argv: [],
env: {}
env: {},
};
2 changes: 1 addition & 1 deletion packages/integrations/deno/test/basics.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ Deno.test({
const html = await resp.text();
assert(html);
});
}
},
});
2 changes: 1 addition & 1 deletion packages/integrations/deno/test/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down

0 comments on commit 6a1a40e

Please sign in to comment.