[ci] format

This commit is contained in:
matthewp 2023-08-24 14:40:44 +00:00 committed by astrobot-houston
parent f1c610636a
commit 4bbcbac0b7
28 changed files with 71 additions and 67 deletions

View file

@ -19,11 +19,10 @@ import type { PageBuildData } from '../core/build/types';
import type { AstroConfigType } from '../core/config';
import type { AstroTimer } from '../core/config/timer';
import type { AstroCookies } from '../core/cookies';
import type { LogOptions, LoggerLevel } from '../core/logger/core';
import type { AstroIntegrationLogger } from '../core/logger/core';
import type { ResponseWithEncoding } from '../core/endpoint/index.js';
import type { AstroIntegrationLogger, LogOptions, LoggerLevel } from '../core/logger/core';
import type { AstroComponentFactory, AstroComponentInstance } from '../runtime/server';
import type { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from './../core/constants.js';
import type { ResponseWithEncoding } from '../core/endpoint/index.js';
export type {
MarkdownHeading,

View file

@ -1,8 +1,8 @@
import { isRemotePath } from '@astrojs/internal-helpers/path';
import mime from 'mime/lite.js';
import type { APIRoute } from '../@types/astro.js';
import { etag } from './utils/etag.js';
import { isRemotePath } from '@astrojs/internal-helpers/path';
import { getConfiguredImageService, isRemoteAllowed } from './internal.js';
import { etag } from './utils/etag.js';
// @ts-expect-error
import { imageConfig } from 'astro:assets';

View file

@ -24,8 +24,8 @@ import {
createStylesheetElementSet,
} from '../render/ssr-element.js';
import { matchRoute } from '../routing/match.js';
import type { RouteInfo } from './types';
import { EndpointNotFoundError, SSRRoutePipeline } from './ssrPipeline.js';
import type { RouteInfo } from './types';
export { deserializeManifest } from './common.js';
const clientLocalsSymbol = Symbol.for('astro.locals');

View file

@ -1,5 +1,5 @@
import type { Environment } from '../render';
import { Pipeline } from '../pipeline.js';
import type { Environment } from '../render';
/**
* Thrown when an endpoint contains a response with the header "X-Astro-Response" === 'Not-Found'

View file

@ -1,15 +1,15 @@
import type { AstroConfig, AstroSettings, SSRLoadedRenderer } from '../../@types/astro';
import { getOutputDirectory, isServerLikeOutput } from '../../prerender/utils.js';
import { BEFORE_HYDRATION_SCRIPT_ID } from '../../vite-plugin-scripts/index.js';
import type { SSRManifest } from '../app/types';
import { Pipeline } from '../pipeline.js';
import { createEnvironment } from '../render/index.js';
import { createAssetLink } from '../render/ssr-element.js';
import type { BuildInternals } from './internal';
import type { PageBuildData, StaticBuildOptions } from './types';
import { ASTRO_PAGE_RESOLVED_MODULE_ID } from './plugins/plugin-pages.js';
import { RESOLVED_SPLIT_MODULE_ID } from './plugins/plugin-ssr.js';
import { ASTRO_PAGE_EXTENSION_POST_PATTERN } from './plugins/util.js';
import type { SSRManifest } from '../app/types';
import type { AstroConfig, AstroSettings, SSRLoadedRenderer } from '../../@types/astro';
import { getOutputDirectory, isServerLikeOutput } from '../../prerender/utils.js';
import { createEnvironment } from '../render/index.js';
import { BEFORE_HYDRATION_SCRIPT_ID } from '../../vite-plugin-scripts/index.js';
import { createAssetLink } from '../render/ssr-element.js';
import type { PageBuildData, StaticBuildOptions } from './types';
/**
* This pipeline is responsible to gather the files emitted by the SSR build and generate the pages by executing these files.

View file

@ -3,6 +3,7 @@ import { bgGreen, black, cyan, dim, green, magenta } from 'kleur/colors';
import fs from 'node:fs';
import { fileURLToPath } from 'node:url';
import type { OutputAsset, OutputChunk } from 'rollup';
import type { BufferEncoding } from 'vfile';
import type {
AstroConfig,
AstroSettings,
@ -32,7 +33,7 @@ import { runHookBuildGenerated } from '../../integrations/index.js';
import { getOutputDirectory, isServerLikeOutput } from '../../prerender/utils.js';
import { PAGE_SCRIPT_ID } from '../../vite-plugin-scripts/index.js';
import { AstroError, AstroErrorData } from '../errors/index.js';
import { debug, info, Logger } from '../logger/core.js';
import { Logger, debug, info } from '../logger/core.js';
import { RedirectSinglePageBuiltModule, getRedirectLocationOrThrow } from '../redirects/index.js';
import { createRenderContext } from '../render/index.js';
import { callGetStaticPaths } from '../render/route-cache.js';
@ -44,6 +45,7 @@ import {
import { createRequest } from '../request.js';
import { matchRoute } from '../routing/match.js';
import { getOutputFilename } from '../util.js';
import { BuildPipeline } from './buildPipeline.js';
import { getOutDirWithinCwd, getOutFile, getOutFolder } from './common.js';
import {
cssOrder,
@ -58,8 +60,6 @@ import type {
StylesheetAsset,
} from './types';
import { getTimeStat } from './util.js';
import { BuildPipeline } from './buildPipeline.js';
import type { BufferEncoding } from 'vfile';
function createEntryURL(filePath: string, outFolder: URL) {
return new URL('./' + filePath + `?time=${Date.now()}`, outFolder);

View file

@ -7,12 +7,12 @@ import { pluginComponentEntry } from './plugin-component-entry.js';
import { pluginCSS } from './plugin-css.js';
import { pluginHoistedScripts } from './plugin-hoisted-scripts.js';
import { pluginInternals } from './plugin-internals.js';
import { pluginManifest } from './plugin-manifest.js';
import { pluginMiddleware } from './plugin-middleware.js';
import { pluginPages } from './plugin-pages.js';
import { pluginPrerender } from './plugin-prerender.js';
import { pluginRenderers } from './plugin-renderers.js';
import { pluginSSR, pluginSSRSplit } from './plugin-ssr.js';
import { pluginManifest } from './plugin-manifest.js';
export function registerAllPlugins({ internals, options, register }: AstroBuildPluginContainer) {
register(pluginComponentEntry(internals));

View file

@ -1,16 +1,16 @@
import { type BuildInternals, cssOrder, mergeInlineCss } from '../internal.js';
import type { AstroBuildPlugin } from '../plugin';
import { type Plugin as VitePlugin } from 'vite';
import { runHookBuildSsr } from '../../../integrations/index.js';
import { addRollupInput } from '../add-rollup-input.js';
import glob from 'fast-glob';
import { fileURLToPath } from 'node:url';
import type { OutputChunk } from 'rollup';
import { getOutFile, getOutFolder } from '../common.js';
import { type Plugin as VitePlugin } from 'vite';
import { runHookBuildSsr } from '../../../integrations/index.js';
import { BEFORE_HYDRATION_SCRIPT_ID, PAGE_SCRIPT_ID } from '../../../vite-plugin-scripts/index.js';
import type { SerializedRouteInfo, SerializedSSRManifest } from '../../app/types';
import { joinPaths, prependForwardSlash } from '../../path.js';
import { serializeRouteData } from '../../routing/index.js';
import type { SerializedRouteInfo, SerializedSSRManifest } from '../../app/types';
import { addRollupInput } from '../add-rollup-input.js';
import { getOutFile, getOutFolder } from '../common.js';
import { cssOrder, mergeInlineCss, type BuildInternals } from '../internal.js';
import type { AstroBuildPlugin } from '../plugin';
import type { StaticBuildOptions } from '../types';
const manifestReplace = '@@ASTRO_MANIFEST_REPLACE@@';

View file

@ -1,5 +1,6 @@
import { extname } from 'node:path';
import type { Plugin as VitePlugin } from 'vite';
import type { AstroSettings } from '../../../@types/astro';
import { routeIsRedirect } from '../../redirects/index.js';
import { addRollupInput } from '../add-rollup-input.js';
import { type BuildInternals } from '../internal.js';
@ -8,7 +9,6 @@ import type { StaticBuildOptions } from '../types';
import { MIDDLEWARE_MODULE_ID } from './plugin-middleware.js';
import { RENDERERS_MODULE_ID } from './plugin-renderers.js';
import { ASTRO_PAGE_EXTENSION_POST_PATTERN, getPathFromVirtualModulePageName } from './util.js';
import type { AstroSettings } from '../../../@types/astro';
export const ASTRO_PAGE_MODULE_ID = '@astro-page:';
export const ASTRO_PAGE_RESOLVED_MODULE_ID = '\0' + ASTRO_PAGE_MODULE_ID;

View file

@ -9,10 +9,10 @@ import { addRollupInput } from '../add-rollup-input.js';
import type { BuildInternals } from '../internal.js';
import type { AstroBuildPlugin } from '../plugin';
import type { StaticBuildOptions } from '../types';
import { SSR_MANIFEST_VIRTUAL_MODULE_ID } from './plugin-manifest.js';
import { ASTRO_PAGE_MODULE_ID } from './plugin-pages.js';
import { RENDERERS_MODULE_ID } from './plugin-renderers.js';
import { getPathFromVirtualModulePageName, getVirtualModulePageNameFromPath } from './util.js';
import { SSR_MANIFEST_VIRTUAL_MODULE_ID } from './plugin-manifest.js';
export const SSR_VIRTUAL_MODULE_ID = '@astrojs-ssr-virtual-entry';
export const RESOLVED_SSR_VIRTUAL_MODULE_ID = '\0' + SSR_VIRTUAL_MODULE_ID;

View file

@ -26,13 +26,13 @@ import { generatePages } from './generate.js';
import { trackPageData } from './internal.js';
import { createPluginContainer, type AstroBuildPluginContainer } from './plugin.js';
import { registerAllPlugins } from './plugins/index.js';
import { RESOLVED_SSR_MANIFEST_VIRTUAL_MODULE_ID } from './plugins/plugin-manifest.js';
import { ASTRO_PAGE_RESOLVED_MODULE_ID } from './plugins/plugin-pages.js';
import { RESOLVED_RENDERERS_MODULE_ID } from './plugins/plugin-renderers.js';
import { RESOLVED_SPLIT_MODULE_ID, RESOLVED_SSR_VIRTUAL_MODULE_ID } from './plugins/plugin-ssr.js';
import { ASTRO_PAGE_EXTENSION_POST_PATTERN } from './plugins/util.js';
import type { PageBuildData, StaticBuildOptions } from './types';
import { getTimeStat } from './util.js';
import { RESOLVED_SSR_MANIFEST_VIRTUAL_MODULE_ID } from './plugins/plugin-manifest.js';
export async function viteBuild(opts: StaticBuildOptions) {
const { allPages, settings } = opts;

View file

@ -19,11 +19,11 @@ import configAliasVitePlugin from '../vite-plugin-config-alias/index.js';
import envVitePlugin from '../vite-plugin-env/index.js';
import astroHeadPlugin from '../vite-plugin-head/index.js';
import htmlVitePlugin from '../vite-plugin-html/index.js';
import mdxVitePlugin from '../vite-plugin-mdx/index.js';
import { astroInjectEnvTsPlugin } from '../vite-plugin-inject-env-ts/index.js';
import astroIntegrationsContainerPlugin from '../vite-plugin-integrations-container/index.js';
import astroLoadFallbackPlugin from '../vite-plugin-load-fallback/index.js';
import markdownVitePlugin from '../vite-plugin-markdown/index.js';
import mdxVitePlugin from '../vite-plugin-mdx/index.js';
import astroScannerPlugin from '../vite-plugin-scanner/index.js';
import astroScriptsPlugin from '../vite-plugin-scripts/index.js';
import astroScriptsPageSSRPlugin from '../vite-plugin-scripts/page-ssr.js';

View file

@ -1,3 +1,4 @@
import mime from 'mime';
import type {
APIContext,
EndpointHandler,
@ -6,14 +7,13 @@ import type {
MiddlewareHandler,
Params,
} from '../../@types/astro';
import mime from 'mime';
import type { Environment, RenderContext } from '../render/index';
import { renderEndpoint } from '../../runtime/server/index.js';
import { ASTRO_VERSION } from '../constants.js';
import { AstroCookies, attachCookiesToResponse } from '../cookies/index.js';
import { AstroError, AstroErrorData } from '../errors/index.js';
import { warn } from '../logger/core.js';
import { callMiddleware } from '../middleware/callMiddleware.js';
import type { Environment, RenderContext } from '../render/index';
const encoder = new TextEncoder();

View file

@ -3,11 +3,11 @@ export * as AstroErrorData from './errors-data.js';
export {
AggregateError,
AstroError,
AstroUserError,
CSSError,
CompilerError,
MarkdownError,
isAstroError,
AstroUserError,
} from './errors.js';
export { codeFrame } from './printer.js';
export { createSafeError, positionAt } from './utils.js';

View file

@ -19,9 +19,9 @@ import type { ZodError } from 'zod';
import { renderErrorMarkdown } from './errors/dev/utils.js';
import {
AstroError,
AstroUserError,
CompilerError,
type ErrorWithMetadata,
AstroUserError,
} from './errors/index.js';
import { emoji, padMultilineString } from './util.js';

View file

@ -1,14 +1,14 @@
import { type RenderContext, type Environment } from './render/index.js';
import { callEndpoint, createAPIContext } from './endpoint/index.js';
import type {
ComponentInstance,
EndpointHandler,
MiddlewareEndpointHandler,
MiddlewareHandler,
MiddlewareResponseHandler,
ComponentInstance,
MiddlewareEndpointHandler,
EndpointHandler,
} from '../@types/astro';
import { callEndpoint, createAPIContext } from './endpoint/index.js';
import { callMiddleware } from './middleware/callMiddleware.js';
import { renderPage } from './render/core.js';
import { type Environment, type RenderContext } from './render/index.js';
type EndpointResultHandler = (
originalRequest: Request,

View file

@ -1,8 +1,8 @@
import type { AstroMiddlewareInstance, ComponentInstance, RouteData } from '../../@types/astro';
import type { Environment } from './environment';
export { createRenderContext } from './context.js';
export type { RenderContext } from './context.js';
export { tryRenderRoute } from './core.js';
import type { Environment } from './environment';
export { createEnvironment } from './environment.js';
export { getParamsAndProps } from './params-and-props.js';
export { loadRenderer } from './renderer.js';

View file

@ -1,8 +1,8 @@
import type { AstroSettings, ComponentInstance, RouteData } from '../@types/astro';
import { RedirectComponentInstance, routeIsRedirect } from '../core/redirects/index.js';
import type DevPipeline from '../vite-plugin-astro-server/devPipeline';
import { preload } from '../vite-plugin-astro-server/index.js';
import { getPrerenderStatus } from './metadata.js';
import type DevPipeline from '../vite-plugin-astro-server/devPipeline';
type GetSortedPreloadedMatchesParams = {
pipeline: DevPipeline;

View file

@ -2,19 +2,19 @@
export {
Fragment,
render,
addAttribute,
createAstro,
createComponent,
createTransitionScope,
defineScriptVars,
defineStyleVars,
maybeRenderHead,
mergeSlots,
render,
renderComponent,
renderHead,
maybeRenderHead,
unescapeHTML,
renderSlot,
mergeSlots,
addAttribute,
renderTransition,
createTransitionScope,
spreadAttributes,
defineStyleVars,
defineScriptVars,
unescapeHTML,
} from '../server/index.js';

View file

@ -1,5 +1,5 @@
import type { APIContext, EndpointHandler, Params } from '../../@types/astro';
import { type LogOptions, warn } from '../../core/logger/core.js';
import { warn, type LogOptions } from '../../core/logger/core.js';
function getHandlerFromModule(mod: EndpointHandler, method: string, logging: LogOptions) {
const lowerCaseMethod = method.toLowerCase();

View file

@ -1,8 +1,8 @@
import type { SSRElement } from '../../../@types/astro';
import type { RenderDestination, RenderDestinationChunk, RenderFunction } from './common.js';
import { HTMLString, markHTMLString } from '../escape.js';
import { clsx } from 'clsx';
import { HTMLString, markHTMLString } from '../escape.js';
export const voidElementNames =
/^(area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)$/i;

View file

@ -1,14 +1,19 @@
import { Pipeline } from '../core/pipeline.js';
import type { AstroConfig, AstroSettings } from '../@types/astro';
import type { ModuleLoader } from '../core/module-loader';
import type { Environment } from '../core/render';
import { createEnvironment, loadRenderer } from '../core/render/index.js';
import { createResolve } from './resolve.js';
import { RouteCache } from '../core/render/route-cache.js';
import { isServerLikeOutput } from '../prerender/utils.js';
import type { RuntimeMode, SSRManifest, SSRLoadedRenderer } from '../@types/astro';
import type {
AstroConfig,
AstroSettings,
RuntimeMode,
SSRLoadedRenderer,
SSRManifest,
} from '../@types/astro';
import type { LogOptions } from '../core/logger/core';
import { Logger } from '../core/logger/core.js';
import type { ModuleLoader } from '../core/module-loader';
import { Pipeline } from '../core/pipeline.js';
import type { Environment } from '../core/render';
import { createEnvironment, loadRenderer } from '../core/render/index.js';
import { RouteCache } from '../core/render/route-cache.js';
import { isServerLikeOutput } from '../prerender/utils.js';
import { createResolve } from './resolve.js';
export default class DevPipeline extends Pipeline {
#settings: AstroSettings;

View file

@ -7,8 +7,8 @@ import { createViteLoader } from '../core/module-loader/index.js';
import { createRouteManifest } from '../core/routing/index.js';
import { baseMiddleware } from './base.js';
import { createController } from './controller.js';
import { handleRequest } from './request.js';
import DevPipeline from './devPipeline.js';
import { handleRequest } from './request.js';
export interface AstroPluginOptions {
settings: AstroSettings;

View file

@ -1,16 +1,16 @@
import type http from 'node:http';
import type { ManifestData, SSRManifest } from '../@types/astro';
import type { DevServerController } from './controller';
import { collectErrorMetadata } from '../core/errors/dev/index.js';
import { createSafeError } from '../core/errors/index.js';
import * as msg from '../core/messages.js';
import { collapseDuplicateSlashes, removeTrailingForwardSlash } from '../core/path.js';
import { eventError, telemetry } from '../events/index.js';
import { isServerLikeOutput } from '../prerender/utils.js';
import type { DevServerController } from './controller';
import { runWithErrorHandling } from './controller.js';
import type DevPipeline from './devPipeline';
import { handle500Response } from './response.js';
import { handleRoute, matchRoute } from './route.js';
import type DevPipeline from './devPipeline';
type HandleRequest = {
pipeline: DevPipeline;

View file

@ -18,11 +18,11 @@ import { isServerLikeOutput } from '../prerender/utils.js';
import { PAGE_SCRIPT_ID } from '../vite-plugin-scripts/index.js';
import { log404 } from './common.js';
import { getStylesForURL } from './css.js';
import type DevPipeline from './devPipeline.js';
import { preload } from './index.js';
import { getComponentMetadata } from './metadata.js';
import { handle404Response, writeSSRResult, writeWebResponse } from './response.js';
import { getScriptsForURL } from './scripts.js';
import type DevPipeline from './devPipeline.js';
const clientLocalsSymbol = Symbol.for('astro.locals');

View file

@ -3,6 +3,7 @@ import { toRemarkInitializeAstroData } from '@astrojs/markdown-remark/dist/inter
import { compile as mdxCompile, type CompileOptions } from '@mdx-js/mdx';
import type { PluggableList } from '@mdx-js/mdx/lib/core.js';
import type { AstroIntegration, ContentEntryType, HookParameters } from 'astro';
import astroJSXRenderer from 'astro/jsx/renderer.js';
import { parse as parseESM } from 'es-module-lexer';
import fs from 'node:fs/promises';
import { fileURLToPath } from 'node:url';
@ -13,7 +14,6 @@ import type { Plugin as VitePlugin } from 'vite';
import { getRehypePlugins, getRemarkPlugins, recmaInjectImportMetaEnvPlugin } from './plugins.js';
import type { OptimizeOptions } from './rehype-optimize-static.js';
import { getFileInfo, ignoreStringPlugins, parseFrontmatter } from './utils.js';
import astroJSXRenderer from 'astro/jsx/renderer.js';
export type MdxOptions = Omit<typeof markdownConfigDefaults, 'remarkPlugins' | 'rehypePlugins'> & {
extendMarkdownConfig: boolean;

View file

@ -1,5 +1,5 @@
import type { AstroIntegration, AstroRenderer, ViteUserConfig } from 'astro';
import preact, { type PreactPluginOptions as VitePreactPluginOptions } from '@preact/preset-vite';
import type { AstroIntegration, AstroRenderer, ViteUserConfig } from 'astro';
import { fileURLToPath } from 'node:url';
const babelCwd = new URL('../', import.meta.url);

View file

@ -1,7 +1,7 @@
import { appendForwardSlash } from '@astrojs/internal-helpers/path';
import react, { type Options as ViteReactPluginOptions } from '@vitejs/plugin-react';
import type { AstroIntegration } from 'astro';
import { version as ReactVersion } from 'react-dom';
import react, { type Options as ViteReactPluginOptions } from '@vitejs/plugin-react';
import { appendForwardSlash } from '@astrojs/internal-helpers/path';
import type * as vite from 'vite';
export type ReactIntegrationOptions = Pick<ViteReactPluginOptions, 'include' | 'exclude'> & {