[ci] npm run format
This commit is contained in:
parent
7def0463b1
commit
b92b9f66e5
5 changed files with 13 additions and 19 deletions
20
src/build.ts
20
src/build.ts
|
@ -1,10 +1,7 @@
|
|||
import type { AstroConfig } from './@types/astro';
|
||||
import { defaultLogOptions, LogOptions } from './logger';
|
||||
|
||||
import {
|
||||
loadConfiguration,
|
||||
startServer as startSnowpackServer,
|
||||
build as snowpackBuild } from 'snowpack';
|
||||
import { loadConfiguration, startServer as startSnowpackServer, build as snowpackBuild } from 'snowpack';
|
||||
import { promises as fsPromises } from 'fs';
|
||||
import { relative as pathRelative } from 'path';
|
||||
import { defaultLogDestination, error } from './logger.js';
|
||||
|
@ -25,7 +22,7 @@ async function* allPages(root: URL): AsyncGenerator<URL, void, unknown> {
|
|||
if (info.isDirectory()) {
|
||||
yield* allPages(new URL(fullpath + '/'));
|
||||
} else {
|
||||
if(/\.(astro|md)$/.test(fullpath.pathname)) {
|
||||
if (/\.(astro|md)$/.test(fullpath.pathname)) {
|
||||
yield fullpath;
|
||||
}
|
||||
}
|
||||
|
@ -39,7 +36,7 @@ export async function build(astroConfig: AstroConfig): Promise<0 | 1> {
|
|||
|
||||
const runtimeLogging: LogOptions = {
|
||||
level: 'error',
|
||||
dest: defaultLogDestination
|
||||
dest: defaultLogDestination,
|
||||
};
|
||||
|
||||
const runtime = await createRuntime(astroConfig, { logging: runtimeLogging, env: 'build' });
|
||||
|
@ -48,10 +45,9 @@ export async function build(astroConfig: AstroConfig): Promise<0 | 1> {
|
|||
try {
|
||||
const result = await snowpackBuild({
|
||||
config: snowpackConfig,
|
||||
lockfile: null
|
||||
lockfile: null,
|
||||
});
|
||||
|
||||
} catch(err) {
|
||||
} catch (err) {
|
||||
error(logging, 'build', err);
|
||||
return 1;
|
||||
}
|
||||
|
@ -64,8 +60,8 @@ export async function build(astroConfig: AstroConfig): Promise<0 | 1> {
|
|||
const outPath = new URL('./' + rel.replace(/\.(astro|md)/, '.html'), dist);
|
||||
const outFolder = new URL('./', outPath);
|
||||
const result = await runtime.load(pagePath);
|
||||
|
||||
if(result.statusCode !== 200) {
|
||||
|
||||
if (result.statusCode !== 200) {
|
||||
error(logging, 'generate', result.error || result.statusCode);
|
||||
//return 1;
|
||||
} else {
|
||||
|
@ -80,4 +76,4 @@ export async function build(astroConfig: AstroConfig): Promise<0 | 1> {
|
|||
|
||||
await runtime.shutdown();
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,11 +73,9 @@ export async function optimize(ast: Ast, opts: OptimizeOptions) {
|
|||
const cssVisitors = createVisitorCollection();
|
||||
const finalizers: Array<() => Promise<void>> = [];
|
||||
|
||||
const optimizers = [
|
||||
optimizeStyles(opts)
|
||||
];
|
||||
const optimizers = [optimizeStyles(opts)];
|
||||
|
||||
for(const optimizer of optimizers) {
|
||||
for (const optimizer of optimizers) {
|
||||
collectVisitors(optimizer, htmlVisitors, cssVisitors, finalizers);
|
||||
}
|
||||
|
||||
|
|
|
@ -39,4 +39,4 @@ export const parse_expression_at = (source: string, index: number): number => {
|
|||
// sourceType: 'module',
|
||||
// ecmaVersion: 2020,
|
||||
// locations: true,
|
||||
// });
|
||||
// });
|
||||
|
|
|
@ -37,4 +37,4 @@ export default function read_expression(parser: Parser): string {
|
|||
} catch (err) {
|
||||
parser.acorn_error(err);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -351,7 +351,7 @@ function read_attribute(parser: Parser, unique_names: Set<string>) {
|
|||
parser.allow_whitespace();
|
||||
|
||||
if (parser.eat('...')) {
|
||||
const {expression} = read_expression(parser);
|
||||
const { expression } = read_expression(parser);
|
||||
|
||||
parser.allow_whitespace();
|
||||
parser.eat('}', true);
|
||||
|
|
Loading…
Reference in a new issue