[ci] format
This commit is contained in:
parent
13b271bc7d
commit
6a1a40eef8
14 changed files with 29 additions and 33 deletions
|
@ -681,7 +681,7 @@ export interface AstroIntegration {
|
||||||
'astro:server:start'?: (options: { address: AddressInfo }) => void | Promise<void>;
|
'astro:server:start'?: (options: { address: AddressInfo }) => void | Promise<void>;
|
||||||
'astro:server:done'?: () => void | Promise<void>;
|
'astro:server:done'?: () => void | Promise<void>;
|
||||||
'astro:build:start'?: (options: { buildConfig: BuildConfig }) => 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>;
|
'astro:build:done'?: (options: { pages: { pathname: string }[]; dir: URL; routes: RouteData[] }) => void | Promise<void>;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@ export class App {
|
||||||
#encoder = new TextEncoder();
|
#encoder = new TextEncoder();
|
||||||
#logging: LogOptions = {
|
#logging: LogOptions = {
|
||||||
dest: consoleLogDestination,
|
dest: consoleLogDestination,
|
||||||
level: 'info'
|
level: 'info',
|
||||||
};
|
};
|
||||||
|
|
||||||
constructor(manifest: Manifest) {
|
constructor(manifest: Manifest) {
|
||||||
|
|
|
@ -157,7 +157,7 @@ async function ssrBuild(opts: StaticBuildOptions, internals: BuildInternals, inp
|
||||||
server: viteConfig.server,
|
server: viteConfig.server,
|
||||||
base: astroConfig.buildOptions.site ? new URL(astroConfig.buildOptions.site).pathname : '/',
|
base: astroConfig.buildOptions.site ? new URL(astroConfig.buildOptions.site).pathname : '/',
|
||||||
ssr: viteConfig.ssr,
|
ssr: viteConfig.ssr,
|
||||||
resolve: viteConfig.resolve
|
resolve: viteConfig.resolve,
|
||||||
} as ViteConfigWithSSR;
|
} as ViteConfigWithSSR;
|
||||||
|
|
||||||
await runHookBuildSetup({ config: astroConfig, vite: viteBuildConfig, target: 'server' });
|
await runHookBuildSetup({ config: astroConfig, vite: viteBuildConfig, target: 'server' });
|
||||||
|
|
|
@ -85,8 +85,8 @@ export async function createVite(commandConfig: ViteConfigWithSSR, { astroConfig
|
||||||
alias: {
|
alias: {
|
||||||
// This is needed for Deno compatibility, as the non-browser version
|
// This is needed for Deno compatibility, as the non-browser version
|
||||||
// of this module depends on Node `crypto`
|
// 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)
|
// Note: SSR API is in beta (https://vitejs.dev/guide/ssr.html)
|
||||||
ssr: {
|
ssr: {
|
||||||
|
|
|
@ -10,7 +10,6 @@ type ConsoleStream = Writable & {
|
||||||
fd: 1 | 2;
|
fd: 1 | 2;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
let lastMessage: string;
|
let lastMessage: string;
|
||||||
let lastMessageCount = 1;
|
let lastMessageCount = 1;
|
||||||
export const nodeLogDestination = new Writable({
|
export const nodeLogDestination = new Writable({
|
||||||
|
@ -125,7 +124,6 @@ export const logger = {
|
||||||
error: error.bind(null, nodeLogOptions),
|
error: error.bind(null, nodeLogOptions),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
export function enableVerboseLogging() {
|
export function enableVerboseLogging() {
|
||||||
//debugPackage.enable('*,-babel');
|
//debugPackage.enable('*,-babel');
|
||||||
debug('cli', '--verbose flag enabled! Enabling: DEBUG="*,-babel"');
|
debug('cli', '--verbose flag enabled! Enabling: DEBUG="*,-babel"');
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
|
|
||||||
// Vendored from https://github.com/genmon/aboutfeeds/blob/main/tools/pretty-feed-v3.xsl
|
// Vendored from https://github.com/genmon/aboutfeeds/blob/main/tools/pretty-feed-v3.xsl
|
||||||
/** Basic stylesheet for RSS feeds */
|
/** Basic stylesheet for RSS feeds */
|
||||||
export const PRETTY_FEED_V3 = `<?xml version="1.0" encoding="utf-8"?>
|
export const PRETTY_FEED_V3 = `<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
|
|
@ -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) {
|
for (const integration of config.integrations) {
|
||||||
if (integration.hooks['astro:build:setup']) {
|
if (integration.hooks['astro:build:setup']) {
|
||||||
await integration.hooks['astro:build:setup']({ vite, target });
|
await integration.hooks['astro:build:setup']({ vite, target });
|
||||||
|
|
|
@ -74,7 +74,7 @@ export async function loadFixture(inlineConfig) {
|
||||||
/** @type {import('../src/core/logger/core').LogOptions} */
|
/** @type {import('../src/core/logger/core').LogOptions} */
|
||||||
const logging = {
|
const logging = {
|
||||||
dest: nodeLogDestination,
|
dest: nodeLogDestination,
|
||||||
level: 'error'
|
level: 'error',
|
||||||
};
|
};
|
||||||
|
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -10,7 +10,7 @@ export function getAdapter(args?: Options): AstroAdapter {
|
||||||
name: '@astrojs/deno',
|
name: '@astrojs/deno',
|
||||||
serverEntrypoint: '@astrojs/deno/server.js',
|
serverEntrypoint: '@astrojs/deno/server.js',
|
||||||
args: args ?? {},
|
args: args ?? {},
|
||||||
exports: ['stop', 'handle']
|
exports: ['stop', 'handle'],
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,10 +24,10 @@ export default function createIntegration(args?: Options): AstroIntegration {
|
||||||
'astro:build:setup': ({ vite, target }) => {
|
'astro:build:setup': ({ vite, target }) => {
|
||||||
if (target === 'server') {
|
if (target === 'server') {
|
||||||
vite.ssr = {
|
vite.ssr = {
|
||||||
noExternal: true
|
noExternal: true,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,7 @@ import './shim.js';
|
||||||
import type { SSRManifest } from 'astro';
|
import type { SSRManifest } from 'astro';
|
||||||
import { App } from 'astro/app';
|
import { App } from 'astro/app';
|
||||||
// @ts-ignore
|
// @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 {
|
interface Options {
|
||||||
port?: number;
|
port?: number;
|
||||||
|
@ -27,7 +27,7 @@ export function start(manifest: SSRManifest, options: Options) {
|
||||||
|
|
||||||
_server = new Server({
|
_server = new Server({
|
||||||
port: options.port ?? 8085,
|
port: options.port ?? 8085,
|
||||||
hostname: options.hostname ?? "0.0.0.0",
|
hostname: options.hostname ?? '0.0.0.0',
|
||||||
handler,
|
handler,
|
||||||
//onError: options.onError,
|
//onError: options.onError,
|
||||||
});
|
});
|
||||||
|
@ -46,6 +46,6 @@ export function createExports(manifest: SSRManifest) {
|
||||||
},
|
},
|
||||||
async handle(request: Request) {
|
async handle(request: Request) {
|
||||||
return app.render(request);
|
return app.render(request);
|
||||||
}
|
},
|
||||||
}
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
|
|
||||||
(globalThis as any).process = {
|
(globalThis as any).process = {
|
||||||
argv: [],
|
argv: [],
|
||||||
env: {}
|
env: {},
|
||||||
};
|
};
|
||||||
|
|
|
@ -10,5 +10,5 @@ Deno.test({
|
||||||
const html = await resp.text();
|
const html = await resp.text();
|
||||||
assert(html);
|
assert(html);
|
||||||
});
|
});
|
||||||
}
|
},
|
||||||
});
|
});
|
||||||
|
|
|
@ -4,7 +4,7 @@ const dir = new URL('./', import.meta.url);
|
||||||
export async function runBuild(fixturePath) {
|
export async function runBuild(fixturePath) {
|
||||||
let proc = Deno.run({
|
let proc = Deno.run({
|
||||||
cmd: ['node', '../../../../../astro/astro.js', 'build', '--silent'],
|
cmd: ['node', '../../../../../astro/astro.js', 'build', '--silent'],
|
||||||
cwd: fromFileUrl(new URL(fixturePath, dir))
|
cwd: fromFileUrl(new URL(fixturePath, dir)),
|
||||||
});
|
});
|
||||||
await proc.status();
|
await proc.status();
|
||||||
return async () => await proc.close();
|
return async () => await proc.close();
|
||||||
|
|
Loading…
Reference in a new issue