Skip to content

Commit

Permalink
[ci] format
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewp authored and astrobot-houston committed Aug 24, 2023
1 parent f1c6106 commit 4bbcbac
Show file tree
Hide file tree
Showing 28 changed files with 68 additions and 64 deletions.
5 changes: 2 additions & 3 deletions packages/astro/src/@types/astro.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/assets/image-endpoint.ts
Original file line number Diff line number Diff line change
@@ -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';

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 @@ -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');
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/app/ssrPipeline.ts
Original file line number Diff line number Diff line change
@@ -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'
Expand Down
14 changes: 7 additions & 7 deletions packages/astro/src/core/build/buildPipeline.ts
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
6 changes: 3 additions & 3 deletions packages/astro/src/core/build/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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';
Expand All @@ -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,
Expand All @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/build/plugins/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down
14 changes: 7 additions & 7 deletions packages/astro/src/core/build/plugins/plugin-manifest.ts
Original file line number Diff line number Diff line change
@@ -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@@';
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/build/plugins/plugin-pages.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/build/plugins/plugin-ssr.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
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 @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/create-vite.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/core/endpoint/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import mime from 'mime';
import type {
APIContext,
EndpointHandler,
Expand All @@ -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();

Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/errors/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
2 changes: 1 addition & 1 deletion packages/astro/src/core/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down
10 changes: 5 additions & 5 deletions packages/astro/src/core/pipeline.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { type RenderContext, type Environment } from './render/index.js';
import { callEndpoint, createAPIContext } from './endpoint/index.js';
import type {
MiddlewareHandler,
MiddlewareResponseHandler,
ComponentInstance,
MiddlewareEndpointHandler,
EndpointHandler,
MiddlewareEndpointHandler,
MiddlewareHandler,
MiddlewareResponseHandler,
} 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,
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/core/render/index.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/prerender/routing.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
16 changes: 8 additions & 8 deletions packages/astro/src/runtime/compiler/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
2 changes: 1 addition & 1 deletion packages/astro/src/runtime/server/endpoint.ts
Original file line number Diff line number Diff line change
@@ -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();
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/runtime/server/render/util.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
17 changes: 11 additions & 6 deletions packages/astro/src/vite-plugin-astro-server/devPipeline.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,19 @@
import { Pipeline } from '../core/pipeline.js';
import type { AstroConfig, AstroSettings } 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 { 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 { LogOptions } from '../core/logger/core';
import { Logger } from '../core/logger/core.js';
import { createResolve } from './resolve.js';

export default class DevPipeline extends Pipeline {
#settings: AstroSettings;
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/vite-plugin-astro-server/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/vite-plugin-astro-server/request.ts
Original file line number Diff line number Diff line change
@@ -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;
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/src/vite-plugin-astro-server/route.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down

0 comments on commit 4bbcbac

Please sign in to comment.