From 4bbcbac0b73c7e34b81ba2e4eeee08481fde1eaa Mon Sep 17 00:00:00 2001 From: matthewp Date: Thu, 24 Aug 2023 14:40:44 +0000 Subject: [PATCH] [ci] format --- packages/astro/src/@types/astro.ts | 5 ++-- packages/astro/src/assets/image-endpoint.ts | 4 ++-- packages/astro/src/core/app/index.ts | 2 +- packages/astro/src/core/app/ssrPipeline.ts | 2 +- .../astro/src/core/build/buildPipeline.ts | 14 +++++------ packages/astro/src/core/build/generate.ts | 6 ++--- .../astro/src/core/build/plugins/index.ts | 2 +- .../src/core/build/plugins/plugin-manifest.ts | 14 +++++------ .../src/core/build/plugins/plugin-pages.ts | 2 +- .../src/core/build/plugins/plugin-ssr.ts | 2 +- packages/astro/src/core/build/static-build.ts | 2 +- packages/astro/src/core/create-vite.ts | 2 +- packages/astro/src/core/endpoint/index.ts | 4 ++-- packages/astro/src/core/errors/index.ts | 2 +- packages/astro/src/core/messages.ts | 2 +- packages/astro/src/core/pipeline.ts | 10 ++++---- packages/astro/src/core/render/index.ts | 2 +- packages/astro/src/prerender/routing.ts | 2 +- packages/astro/src/runtime/compiler/index.ts | 16 ++++++------- packages/astro/src/runtime/server/endpoint.ts | 2 +- .../astro/src/runtime/server/render/util.ts | 2 +- .../vite-plugin-astro-server/devPipeline.ts | 23 +++++++++++-------- .../src/vite-plugin-astro-server/plugin.ts | 2 +- .../src/vite-plugin-astro-server/request.ts | 4 ++-- .../src/vite-plugin-astro-server/route.ts | 2 +- packages/integrations/mdx/src/index.ts | 2 +- packages/integrations/preact/src/index.ts | 2 +- packages/integrations/react/src/index.ts | 4 ++-- 28 files changed, 71 insertions(+), 67 deletions(-) diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index 2be15923b..e6dfd029e 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -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, diff --git a/packages/astro/src/assets/image-endpoint.ts b/packages/astro/src/assets/image-endpoint.ts index aa2baf0a5..b7f027536 100644 --- a/packages/astro/src/assets/image-endpoint.ts +++ b/packages/astro/src/assets/image-endpoint.ts @@ -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'; diff --git a/packages/astro/src/core/app/index.ts b/packages/astro/src/core/app/index.ts index 95abac957..566d0c60d 100644 --- a/packages/astro/src/core/app/index.ts +++ b/packages/astro/src/core/app/index.ts @@ -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'); diff --git a/packages/astro/src/core/app/ssrPipeline.ts b/packages/astro/src/core/app/ssrPipeline.ts index fa354becf..964c9f8c7 100644 --- a/packages/astro/src/core/app/ssrPipeline.ts +++ b/packages/astro/src/core/app/ssrPipeline.ts @@ -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' diff --git a/packages/astro/src/core/build/buildPipeline.ts b/packages/astro/src/core/build/buildPipeline.ts index 52d694077..5815fa5f5 100644 --- a/packages/astro/src/core/build/buildPipeline.ts +++ b/packages/astro/src/core/build/buildPipeline.ts @@ -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. diff --git a/packages/astro/src/core/build/generate.ts b/packages/astro/src/core/build/generate.ts index 5ec60b86d..224b96b63 100644 --- a/packages/astro/src/core/build/generate.ts +++ b/packages/astro/src/core/build/generate.ts @@ -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); diff --git a/packages/astro/src/core/build/plugins/index.ts b/packages/astro/src/core/build/plugins/index.ts index 19c952660..600e083e2 100644 --- a/packages/astro/src/core/build/plugins/index.ts +++ b/packages/astro/src/core/build/plugins/index.ts @@ -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)); diff --git a/packages/astro/src/core/build/plugins/plugin-manifest.ts b/packages/astro/src/core/build/plugins/plugin-manifest.ts index 2c2ceb7e1..a7b254554 100644 --- a/packages/astro/src/core/build/plugins/plugin-manifest.ts +++ b/packages/astro/src/core/build/plugins/plugin-manifest.ts @@ -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@@'; diff --git a/packages/astro/src/core/build/plugins/plugin-pages.ts b/packages/astro/src/core/build/plugins/plugin-pages.ts index ff63acd74..13891f812 100644 --- a/packages/astro/src/core/build/plugins/plugin-pages.ts +++ b/packages/astro/src/core/build/plugins/plugin-pages.ts @@ -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; diff --git a/packages/astro/src/core/build/plugins/plugin-ssr.ts b/packages/astro/src/core/build/plugins/plugin-ssr.ts index 098b9dee8..8650d5870 100644 --- a/packages/astro/src/core/build/plugins/plugin-ssr.ts +++ b/packages/astro/src/core/build/plugins/plugin-ssr.ts @@ -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; diff --git a/packages/astro/src/core/build/static-build.ts b/packages/astro/src/core/build/static-build.ts index a1c7c3e56..6227e99c6 100644 --- a/packages/astro/src/core/build/static-build.ts +++ b/packages/astro/src/core/build/static-build.ts @@ -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; diff --git a/packages/astro/src/core/create-vite.ts b/packages/astro/src/core/create-vite.ts index f4938d2eb..22643b694 100644 --- a/packages/astro/src/core/create-vite.ts +++ b/packages/astro/src/core/create-vite.ts @@ -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'; diff --git a/packages/astro/src/core/endpoint/index.ts b/packages/astro/src/core/endpoint/index.ts index 9c3b57133..11ade7f33 100644 --- a/packages/astro/src/core/endpoint/index.ts +++ b/packages/astro/src/core/endpoint/index.ts @@ -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(); diff --git a/packages/astro/src/core/errors/index.ts b/packages/astro/src/core/errors/index.ts index 5a796a0b3..0f0096eb4 100644 --- a/packages/astro/src/core/errors/index.ts +++ b/packages/astro/src/core/errors/index.ts @@ -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'; diff --git a/packages/astro/src/core/messages.ts b/packages/astro/src/core/messages.ts index 4fc3ca02a..dfa99c51d 100644 --- a/packages/astro/src/core/messages.ts +++ b/packages/astro/src/core/messages.ts @@ -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'; diff --git a/packages/astro/src/core/pipeline.ts b/packages/astro/src/core/pipeline.ts index 19e1ef82b..238f19fbf 100644 --- a/packages/astro/src/core/pipeline.ts +++ b/packages/astro/src/core/pipeline.ts @@ -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, diff --git a/packages/astro/src/core/render/index.ts b/packages/astro/src/core/render/index.ts index f39c02ae2..67c82b5c8 100644 --- a/packages/astro/src/core/render/index.ts +++ b/packages/astro/src/core/render/index.ts @@ -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'; diff --git a/packages/astro/src/prerender/routing.ts b/packages/astro/src/prerender/routing.ts index 2fcfe207b..99ee2886b 100644 --- a/packages/astro/src/prerender/routing.ts +++ b/packages/astro/src/prerender/routing.ts @@ -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; diff --git a/packages/astro/src/runtime/compiler/index.ts b/packages/astro/src/runtime/compiler/index.ts index a5c238b68..6123d6199 100644 --- a/packages/astro/src/runtime/compiler/index.ts +++ b/packages/astro/src/runtime/compiler/index.ts @@ -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'; diff --git a/packages/astro/src/runtime/server/endpoint.ts b/packages/astro/src/runtime/server/endpoint.ts index 89c35957c..91f19fd57 100644 --- a/packages/astro/src/runtime/server/endpoint.ts +++ b/packages/astro/src/runtime/server/endpoint.ts @@ -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(); diff --git a/packages/astro/src/runtime/server/render/util.ts b/packages/astro/src/runtime/server/render/util.ts index f9783fce3..5e99eb008 100644 --- a/packages/astro/src/runtime/server/render/util.ts +++ b/packages/astro/src/runtime/server/render/util.ts @@ -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; diff --git a/packages/astro/src/vite-plugin-astro-server/devPipeline.ts b/packages/astro/src/vite-plugin-astro-server/devPipeline.ts index a17472895..6bb8e86eb 100644 --- a/packages/astro/src/vite-plugin-astro-server/devPipeline.ts +++ b/packages/astro/src/vite-plugin-astro-server/devPipeline.ts @@ -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; diff --git a/packages/astro/src/vite-plugin-astro-server/plugin.ts b/packages/astro/src/vite-plugin-astro-server/plugin.ts index 262d50148..f7f7b0068 100644 --- a/packages/astro/src/vite-plugin-astro-server/plugin.ts +++ b/packages/astro/src/vite-plugin-astro-server/plugin.ts @@ -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; diff --git a/packages/astro/src/vite-plugin-astro-server/request.ts b/packages/astro/src/vite-plugin-astro-server/request.ts index 72ce29b1b..cea9349e0 100644 --- a/packages/astro/src/vite-plugin-astro-server/request.ts +++ b/packages/astro/src/vite-plugin-astro-server/request.ts @@ -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; diff --git a/packages/astro/src/vite-plugin-astro-server/route.ts b/packages/astro/src/vite-plugin-astro-server/route.ts index 5604759e6..d4f0118ee 100644 --- a/packages/astro/src/vite-plugin-astro-server/route.ts +++ b/packages/astro/src/vite-plugin-astro-server/route.ts @@ -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'); diff --git a/packages/integrations/mdx/src/index.ts b/packages/integrations/mdx/src/index.ts index e9c6924c6..8366698d5 100644 --- a/packages/integrations/mdx/src/index.ts +++ b/packages/integrations/mdx/src/index.ts @@ -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 & { extendMarkdownConfig: boolean; diff --git a/packages/integrations/preact/src/index.ts b/packages/integrations/preact/src/index.ts index 9551f97eb..85c3c66ec 100644 --- a/packages/integrations/preact/src/index.ts +++ b/packages/integrations/preact/src/index.ts @@ -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); diff --git a/packages/integrations/react/src/index.ts b/packages/integrations/react/src/index.ts index 1cc200bc3..a09544baf 100644 --- a/packages/integrations/react/src/index.ts +++ b/packages/integrations/react/src/index.ts @@ -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 & {