[ci] format
This commit is contained in:
parent
f1c610636a
commit
4bbcbac0b7
28 changed files with 71 additions and 67 deletions
|
@ -19,11 +19,10 @@ import type { PageBuildData } from '../core/build/types';
|
||||||
import type { AstroConfigType } from '../core/config';
|
import type { AstroConfigType } from '../core/config';
|
||||||
import type { AstroTimer } from '../core/config/timer';
|
import type { AstroTimer } from '../core/config/timer';
|
||||||
import type { AstroCookies } from '../core/cookies';
|
import type { AstroCookies } from '../core/cookies';
|
||||||
import type { LogOptions, LoggerLevel } from '../core/logger/core';
|
import type { ResponseWithEncoding } from '../core/endpoint/index.js';
|
||||||
import type { AstroIntegrationLogger } from '../core/logger/core';
|
import type { AstroIntegrationLogger, LogOptions, LoggerLevel } from '../core/logger/core';
|
||||||
import type { AstroComponentFactory, AstroComponentInstance } from '../runtime/server';
|
import type { AstroComponentFactory, AstroComponentInstance } from '../runtime/server';
|
||||||
import type { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from './../core/constants.js';
|
import type { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from './../core/constants.js';
|
||||||
import type { ResponseWithEncoding } from '../core/endpoint/index.js';
|
|
||||||
|
|
||||||
export type {
|
export type {
|
||||||
MarkdownHeading,
|
MarkdownHeading,
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
|
import { isRemotePath } from '@astrojs/internal-helpers/path';
|
||||||
import mime from 'mime/lite.js';
|
import mime from 'mime/lite.js';
|
||||||
import type { APIRoute } from '../@types/astro.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 { getConfiguredImageService, isRemoteAllowed } from './internal.js';
|
||||||
|
import { etag } from './utils/etag.js';
|
||||||
// @ts-expect-error
|
// @ts-expect-error
|
||||||
import { imageConfig } from 'astro:assets';
|
import { imageConfig } from 'astro:assets';
|
||||||
|
|
||||||
|
|
|
@ -24,8 +24,8 @@ import {
|
||||||
createStylesheetElementSet,
|
createStylesheetElementSet,
|
||||||
} from '../render/ssr-element.js';
|
} from '../render/ssr-element.js';
|
||||||
import { matchRoute } from '../routing/match.js';
|
import { matchRoute } from '../routing/match.js';
|
||||||
import type { RouteInfo } from './types';
|
|
||||||
import { EndpointNotFoundError, SSRRoutePipeline } from './ssrPipeline.js';
|
import { EndpointNotFoundError, SSRRoutePipeline } from './ssrPipeline.js';
|
||||||
|
import type { RouteInfo } from './types';
|
||||||
export { deserializeManifest } from './common.js';
|
export { deserializeManifest } from './common.js';
|
||||||
|
|
||||||
const clientLocalsSymbol = Symbol.for('astro.locals');
|
const clientLocalsSymbol = Symbol.for('astro.locals');
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { Environment } from '../render';
|
|
||||||
import { Pipeline } from '../pipeline.js';
|
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'
|
* Thrown when an endpoint contains a response with the header "X-Astro-Response" === 'Not-Found'
|
||||||
|
|
|
@ -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 { Pipeline } from '../pipeline.js';
|
||||||
|
import { createEnvironment } from '../render/index.js';
|
||||||
|
import { createAssetLink } from '../render/ssr-element.js';
|
||||||
import type { BuildInternals } from './internal';
|
import type { BuildInternals } from './internal';
|
||||||
import type { PageBuildData, StaticBuildOptions } from './types';
|
|
||||||
import { ASTRO_PAGE_RESOLVED_MODULE_ID } from './plugins/plugin-pages.js';
|
import { ASTRO_PAGE_RESOLVED_MODULE_ID } from './plugins/plugin-pages.js';
|
||||||
import { RESOLVED_SPLIT_MODULE_ID } from './plugins/plugin-ssr.js';
|
import { RESOLVED_SPLIT_MODULE_ID } from './plugins/plugin-ssr.js';
|
||||||
import { ASTRO_PAGE_EXTENSION_POST_PATTERN } from './plugins/util.js';
|
import { ASTRO_PAGE_EXTENSION_POST_PATTERN } from './plugins/util.js';
|
||||||
import type { SSRManifest } from '../app/types';
|
import type { PageBuildData, StaticBuildOptions } from './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';
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This pipeline is responsible to gather the files emitted by the SSR build and generate the pages by executing these files.
|
* This pipeline is responsible to gather the files emitted by the SSR build and generate the pages by executing these files.
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { bgGreen, black, cyan, dim, green, magenta } from 'kleur/colors';
|
||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import type { OutputAsset, OutputChunk } from 'rollup';
|
import type { OutputAsset, OutputChunk } from 'rollup';
|
||||||
|
import type { BufferEncoding } from 'vfile';
|
||||||
import type {
|
import type {
|
||||||
AstroConfig,
|
AstroConfig,
|
||||||
AstroSettings,
|
AstroSettings,
|
||||||
|
@ -32,7 +33,7 @@ import { runHookBuildGenerated } from '../../integrations/index.js';
|
||||||
import { getOutputDirectory, isServerLikeOutput } from '../../prerender/utils.js';
|
import { getOutputDirectory, isServerLikeOutput } from '../../prerender/utils.js';
|
||||||
import { PAGE_SCRIPT_ID } from '../../vite-plugin-scripts/index.js';
|
import { PAGE_SCRIPT_ID } from '../../vite-plugin-scripts/index.js';
|
||||||
import { AstroError, AstroErrorData } from '../errors/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 { RedirectSinglePageBuiltModule, getRedirectLocationOrThrow } from '../redirects/index.js';
|
||||||
import { createRenderContext } from '../render/index.js';
|
import { createRenderContext } from '../render/index.js';
|
||||||
import { callGetStaticPaths } from '../render/route-cache.js';
|
import { callGetStaticPaths } from '../render/route-cache.js';
|
||||||
|
@ -44,6 +45,7 @@ import {
|
||||||
import { createRequest } from '../request.js';
|
import { createRequest } from '../request.js';
|
||||||
import { matchRoute } from '../routing/match.js';
|
import { matchRoute } from '../routing/match.js';
|
||||||
import { getOutputFilename } from '../util.js';
|
import { getOutputFilename } from '../util.js';
|
||||||
|
import { BuildPipeline } from './buildPipeline.js';
|
||||||
import { getOutDirWithinCwd, getOutFile, getOutFolder } from './common.js';
|
import { getOutDirWithinCwd, getOutFile, getOutFolder } from './common.js';
|
||||||
import {
|
import {
|
||||||
cssOrder,
|
cssOrder,
|
||||||
|
@ -58,8 +60,6 @@ import type {
|
||||||
StylesheetAsset,
|
StylesheetAsset,
|
||||||
} from './types';
|
} from './types';
|
||||||
import { getTimeStat } from './util.js';
|
import { getTimeStat } from './util.js';
|
||||||
import { BuildPipeline } from './buildPipeline.js';
|
|
||||||
import type { BufferEncoding } from 'vfile';
|
|
||||||
|
|
||||||
function createEntryURL(filePath: string, outFolder: URL) {
|
function createEntryURL(filePath: string, outFolder: URL) {
|
||||||
return new URL('./' + filePath + `?time=${Date.now()}`, outFolder);
|
return new URL('./' + filePath + `?time=${Date.now()}`, outFolder);
|
||||||
|
|
|
@ -7,12 +7,12 @@ import { pluginComponentEntry } from './plugin-component-entry.js';
|
||||||
import { pluginCSS } from './plugin-css.js';
|
import { pluginCSS } from './plugin-css.js';
|
||||||
import { pluginHoistedScripts } from './plugin-hoisted-scripts.js';
|
import { pluginHoistedScripts } from './plugin-hoisted-scripts.js';
|
||||||
import { pluginInternals } from './plugin-internals.js';
|
import { pluginInternals } from './plugin-internals.js';
|
||||||
|
import { pluginManifest } from './plugin-manifest.js';
|
||||||
import { pluginMiddleware } from './plugin-middleware.js';
|
import { pluginMiddleware } from './plugin-middleware.js';
|
||||||
import { pluginPages } from './plugin-pages.js';
|
import { pluginPages } from './plugin-pages.js';
|
||||||
import { pluginPrerender } from './plugin-prerender.js';
|
import { pluginPrerender } from './plugin-prerender.js';
|
||||||
import { pluginRenderers } from './plugin-renderers.js';
|
import { pluginRenderers } from './plugin-renderers.js';
|
||||||
import { pluginSSR, pluginSSRSplit } from './plugin-ssr.js';
|
import { pluginSSR, pluginSSRSplit } from './plugin-ssr.js';
|
||||||
import { pluginManifest } from './plugin-manifest.js';
|
|
||||||
|
|
||||||
export function registerAllPlugins({ internals, options, register }: AstroBuildPluginContainer) {
|
export function registerAllPlugins({ internals, options, register }: AstroBuildPluginContainer) {
|
||||||
register(pluginComponentEntry(internals));
|
register(pluginComponentEntry(internals));
|
||||||
|
|
|
@ -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 glob from 'fast-glob';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import type { OutputChunk } from 'rollup';
|
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 { 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 { joinPaths, prependForwardSlash } from '../../path.js';
|
||||||
import { serializeRouteData } from '../../routing/index.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';
|
import type { StaticBuildOptions } from '../types';
|
||||||
|
|
||||||
const manifestReplace = '@@ASTRO_MANIFEST_REPLACE@@';
|
const manifestReplace = '@@ASTRO_MANIFEST_REPLACE@@';
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import { extname } from 'node:path';
|
import { extname } from 'node:path';
|
||||||
import type { Plugin as VitePlugin } from 'vite';
|
import type { Plugin as VitePlugin } from 'vite';
|
||||||
|
import type { AstroSettings } from '../../../@types/astro';
|
||||||
import { routeIsRedirect } from '../../redirects/index.js';
|
import { routeIsRedirect } from '../../redirects/index.js';
|
||||||
import { addRollupInput } from '../add-rollup-input.js';
|
import { addRollupInput } from '../add-rollup-input.js';
|
||||||
import { type BuildInternals } from '../internal.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 { MIDDLEWARE_MODULE_ID } from './plugin-middleware.js';
|
||||||
import { RENDERERS_MODULE_ID } from './plugin-renderers.js';
|
import { RENDERERS_MODULE_ID } from './plugin-renderers.js';
|
||||||
import { ASTRO_PAGE_EXTENSION_POST_PATTERN, getPathFromVirtualModulePageName } from './util.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_MODULE_ID = '@astro-page:';
|
||||||
export const ASTRO_PAGE_RESOLVED_MODULE_ID = '\0' + ASTRO_PAGE_MODULE_ID;
|
export const ASTRO_PAGE_RESOLVED_MODULE_ID = '\0' + ASTRO_PAGE_MODULE_ID;
|
||||||
|
|
|
@ -9,10 +9,10 @@ import { addRollupInput } from '../add-rollup-input.js';
|
||||||
import type { BuildInternals } from '../internal.js';
|
import type { BuildInternals } from '../internal.js';
|
||||||
import type { AstroBuildPlugin } from '../plugin';
|
import type { AstroBuildPlugin } from '../plugin';
|
||||||
import type { StaticBuildOptions } from '../types';
|
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 { ASTRO_PAGE_MODULE_ID } from './plugin-pages.js';
|
||||||
import { RENDERERS_MODULE_ID } from './plugin-renderers.js';
|
import { RENDERERS_MODULE_ID } from './plugin-renderers.js';
|
||||||
import { getPathFromVirtualModulePageName, getVirtualModulePageNameFromPath } from './util.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 SSR_VIRTUAL_MODULE_ID = '@astrojs-ssr-virtual-entry';
|
||||||
export const RESOLVED_SSR_VIRTUAL_MODULE_ID = '\0' + SSR_VIRTUAL_MODULE_ID;
|
export const RESOLVED_SSR_VIRTUAL_MODULE_ID = '\0' + SSR_VIRTUAL_MODULE_ID;
|
||||||
|
|
|
@ -26,13 +26,13 @@ import { generatePages } from './generate.js';
|
||||||
import { trackPageData } from './internal.js';
|
import { trackPageData } from './internal.js';
|
||||||
import { createPluginContainer, type AstroBuildPluginContainer } from './plugin.js';
|
import { createPluginContainer, type AstroBuildPluginContainer } from './plugin.js';
|
||||||
import { registerAllPlugins } from './plugins/index.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 { ASTRO_PAGE_RESOLVED_MODULE_ID } from './plugins/plugin-pages.js';
|
||||||
import { RESOLVED_RENDERERS_MODULE_ID } from './plugins/plugin-renderers.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 { 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 { ASTRO_PAGE_EXTENSION_POST_PATTERN } from './plugins/util.js';
|
||||||
import type { PageBuildData, StaticBuildOptions } from './types';
|
import type { PageBuildData, StaticBuildOptions } from './types';
|
||||||
import { getTimeStat } from './util.js';
|
import { getTimeStat } from './util.js';
|
||||||
import { RESOLVED_SSR_MANIFEST_VIRTUAL_MODULE_ID } from './plugins/plugin-manifest.js';
|
|
||||||
|
|
||||||
export async function viteBuild(opts: StaticBuildOptions) {
|
export async function viteBuild(opts: StaticBuildOptions) {
|
||||||
const { allPages, settings } = opts;
|
const { allPages, settings } = opts;
|
||||||
|
|
|
@ -19,11 +19,11 @@ import configAliasVitePlugin from '../vite-plugin-config-alias/index.js';
|
||||||
import envVitePlugin from '../vite-plugin-env/index.js';
|
import envVitePlugin from '../vite-plugin-env/index.js';
|
||||||
import astroHeadPlugin from '../vite-plugin-head/index.js';
|
import astroHeadPlugin from '../vite-plugin-head/index.js';
|
||||||
import htmlVitePlugin from '../vite-plugin-html/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 { astroInjectEnvTsPlugin } from '../vite-plugin-inject-env-ts/index.js';
|
||||||
import astroIntegrationsContainerPlugin from '../vite-plugin-integrations-container/index.js';
|
import astroIntegrationsContainerPlugin from '../vite-plugin-integrations-container/index.js';
|
||||||
import astroLoadFallbackPlugin from '../vite-plugin-load-fallback/index.js';
|
import astroLoadFallbackPlugin from '../vite-plugin-load-fallback/index.js';
|
||||||
import markdownVitePlugin from '../vite-plugin-markdown/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 astroScannerPlugin from '../vite-plugin-scanner/index.js';
|
||||||
import astroScriptsPlugin from '../vite-plugin-scripts/index.js';
|
import astroScriptsPlugin from '../vite-plugin-scripts/index.js';
|
||||||
import astroScriptsPageSSRPlugin from '../vite-plugin-scripts/page-ssr.js';
|
import astroScriptsPageSSRPlugin from '../vite-plugin-scripts/page-ssr.js';
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
import mime from 'mime';
|
||||||
import type {
|
import type {
|
||||||
APIContext,
|
APIContext,
|
||||||
EndpointHandler,
|
EndpointHandler,
|
||||||
|
@ -6,14 +7,13 @@ import type {
|
||||||
MiddlewareHandler,
|
MiddlewareHandler,
|
||||||
Params,
|
Params,
|
||||||
} from '../../@types/astro';
|
} from '../../@types/astro';
|
||||||
import mime from 'mime';
|
|
||||||
import type { Environment, RenderContext } from '../render/index';
|
|
||||||
import { renderEndpoint } from '../../runtime/server/index.js';
|
import { renderEndpoint } from '../../runtime/server/index.js';
|
||||||
import { ASTRO_VERSION } from '../constants.js';
|
import { ASTRO_VERSION } from '../constants.js';
|
||||||
import { AstroCookies, attachCookiesToResponse } from '../cookies/index.js';
|
import { AstroCookies, attachCookiesToResponse } from '../cookies/index.js';
|
||||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||||
import { warn } from '../logger/core.js';
|
import { warn } from '../logger/core.js';
|
||||||
import { callMiddleware } from '../middleware/callMiddleware.js';
|
import { callMiddleware } from '../middleware/callMiddleware.js';
|
||||||
|
import type { Environment, RenderContext } from '../render/index';
|
||||||
|
|
||||||
const encoder = new TextEncoder();
|
const encoder = new TextEncoder();
|
||||||
|
|
||||||
|
|
|
@ -3,11 +3,11 @@ export * as AstroErrorData from './errors-data.js';
|
||||||
export {
|
export {
|
||||||
AggregateError,
|
AggregateError,
|
||||||
AstroError,
|
AstroError,
|
||||||
|
AstroUserError,
|
||||||
CSSError,
|
CSSError,
|
||||||
CompilerError,
|
CompilerError,
|
||||||
MarkdownError,
|
MarkdownError,
|
||||||
isAstroError,
|
isAstroError,
|
||||||
AstroUserError,
|
|
||||||
} from './errors.js';
|
} from './errors.js';
|
||||||
export { codeFrame } from './printer.js';
|
export { codeFrame } from './printer.js';
|
||||||
export { createSafeError, positionAt } from './utils.js';
|
export { createSafeError, positionAt } from './utils.js';
|
||||||
|
|
|
@ -19,9 +19,9 @@ import type { ZodError } from 'zod';
|
||||||
import { renderErrorMarkdown } from './errors/dev/utils.js';
|
import { renderErrorMarkdown } from './errors/dev/utils.js';
|
||||||
import {
|
import {
|
||||||
AstroError,
|
AstroError,
|
||||||
|
AstroUserError,
|
||||||
CompilerError,
|
CompilerError,
|
||||||
type ErrorWithMetadata,
|
type ErrorWithMetadata,
|
||||||
AstroUserError,
|
|
||||||
} from './errors/index.js';
|
} from './errors/index.js';
|
||||||
import { emoji, padMultilineString } from './util.js';
|
import { emoji, padMultilineString } from './util.js';
|
||||||
|
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import { type RenderContext, type Environment } from './render/index.js';
|
|
||||||
import { callEndpoint, createAPIContext } from './endpoint/index.js';
|
|
||||||
import type {
|
import type {
|
||||||
|
ComponentInstance,
|
||||||
|
EndpointHandler,
|
||||||
|
MiddlewareEndpointHandler,
|
||||||
MiddlewareHandler,
|
MiddlewareHandler,
|
||||||
MiddlewareResponseHandler,
|
MiddlewareResponseHandler,
|
||||||
ComponentInstance,
|
|
||||||
MiddlewareEndpointHandler,
|
|
||||||
EndpointHandler,
|
|
||||||
} from '../@types/astro';
|
} from '../@types/astro';
|
||||||
|
import { callEndpoint, createAPIContext } from './endpoint/index.js';
|
||||||
import { callMiddleware } from './middleware/callMiddleware.js';
|
import { callMiddleware } from './middleware/callMiddleware.js';
|
||||||
import { renderPage } from './render/core.js';
|
import { renderPage } from './render/core.js';
|
||||||
|
import { type Environment, type RenderContext } from './render/index.js';
|
||||||
|
|
||||||
type EndpointResultHandler = (
|
type EndpointResultHandler = (
|
||||||
originalRequest: Request,
|
originalRequest: Request,
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import type { AstroMiddlewareInstance, ComponentInstance, RouteData } from '../../@types/astro';
|
import type { AstroMiddlewareInstance, ComponentInstance, RouteData } from '../../@types/astro';
|
||||||
|
import type { Environment } from './environment';
|
||||||
export { createRenderContext } from './context.js';
|
export { createRenderContext } from './context.js';
|
||||||
export type { RenderContext } from './context.js';
|
export type { RenderContext } from './context.js';
|
||||||
export { tryRenderRoute } from './core.js';
|
export { tryRenderRoute } from './core.js';
|
||||||
import type { Environment } from './environment';
|
|
||||||
export { createEnvironment } from './environment.js';
|
export { createEnvironment } from './environment.js';
|
||||||
export { getParamsAndProps } from './params-and-props.js';
|
export { getParamsAndProps } from './params-and-props.js';
|
||||||
export { loadRenderer } from './renderer.js';
|
export { loadRenderer } from './renderer.js';
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import type { AstroSettings, ComponentInstance, RouteData } from '../@types/astro';
|
import type { AstroSettings, ComponentInstance, RouteData } from '../@types/astro';
|
||||||
import { RedirectComponentInstance, routeIsRedirect } from '../core/redirects/index.js';
|
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 { preload } from '../vite-plugin-astro-server/index.js';
|
||||||
import { getPrerenderStatus } from './metadata.js';
|
import { getPrerenderStatus } from './metadata.js';
|
||||||
import type DevPipeline from '../vite-plugin-astro-server/devPipeline';
|
|
||||||
|
|
||||||
type GetSortedPreloadedMatchesParams = {
|
type GetSortedPreloadedMatchesParams = {
|
||||||
pipeline: DevPipeline;
|
pipeline: DevPipeline;
|
||||||
|
|
|
@ -2,19 +2,19 @@
|
||||||
|
|
||||||
export {
|
export {
|
||||||
Fragment,
|
Fragment,
|
||||||
render,
|
addAttribute,
|
||||||
createAstro,
|
createAstro,
|
||||||
createComponent,
|
createComponent,
|
||||||
|
createTransitionScope,
|
||||||
|
defineScriptVars,
|
||||||
|
defineStyleVars,
|
||||||
|
maybeRenderHead,
|
||||||
|
mergeSlots,
|
||||||
|
render,
|
||||||
renderComponent,
|
renderComponent,
|
||||||
renderHead,
|
renderHead,
|
||||||
maybeRenderHead,
|
|
||||||
unescapeHTML,
|
|
||||||
renderSlot,
|
renderSlot,
|
||||||
mergeSlots,
|
|
||||||
addAttribute,
|
|
||||||
renderTransition,
|
renderTransition,
|
||||||
createTransitionScope,
|
|
||||||
spreadAttributes,
|
spreadAttributes,
|
||||||
defineStyleVars,
|
unescapeHTML,
|
||||||
defineScriptVars,
|
|
||||||
} from '../server/index.js';
|
} from '../server/index.js';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { APIContext, EndpointHandler, Params } from '../../@types/astro';
|
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) {
|
function getHandlerFromModule(mod: EndpointHandler, method: string, logging: LogOptions) {
|
||||||
const lowerCaseMethod = method.toLowerCase();
|
const lowerCaseMethod = method.toLowerCase();
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import type { SSRElement } from '../../../@types/astro';
|
import type { SSRElement } from '../../../@types/astro';
|
||||||
import type { RenderDestination, RenderDestinationChunk, RenderFunction } from './common.js';
|
import type { RenderDestination, RenderDestinationChunk, RenderFunction } from './common.js';
|
||||||
|
|
||||||
import { HTMLString, markHTMLString } from '../escape.js';
|
|
||||||
import { clsx } from 'clsx';
|
import { clsx } from 'clsx';
|
||||||
|
import { HTMLString, markHTMLString } from '../escape.js';
|
||||||
|
|
||||||
export const voidElementNames =
|
export const voidElementNames =
|
||||||
/^(area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)$/i;
|
/^(area|base|br|col|command|embed|hr|img|input|keygen|link|meta|param|source|track|wbr)$/i;
|
||||||
|
|
|
@ -1,14 +1,19 @@
|
||||||
import { Pipeline } from '../core/pipeline.js';
|
import type {
|
||||||
import type { AstroConfig, AstroSettings } from '../@types/astro';
|
AstroConfig,
|
||||||
import type { ModuleLoader } from '../core/module-loader';
|
AstroSettings,
|
||||||
import type { Environment } from '../core/render';
|
RuntimeMode,
|
||||||
import { createEnvironment, loadRenderer } from '../core/render/index.js';
|
SSRLoadedRenderer,
|
||||||
import { createResolve } from './resolve.js';
|
SSRManifest,
|
||||||
import { RouteCache } from '../core/render/route-cache.js';
|
} from '../@types/astro';
|
||||||
import { isServerLikeOutput } from '../prerender/utils.js';
|
|
||||||
import type { RuntimeMode, SSRManifest, SSRLoadedRenderer } from '../@types/astro';
|
|
||||||
import type { LogOptions } from '../core/logger/core';
|
import type { LogOptions } from '../core/logger/core';
|
||||||
import { Logger } from '../core/logger/core.js';
|
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 {
|
export default class DevPipeline extends Pipeline {
|
||||||
#settings: AstroSettings;
|
#settings: AstroSettings;
|
||||||
|
|
|
@ -7,8 +7,8 @@ import { createViteLoader } from '../core/module-loader/index.js';
|
||||||
import { createRouteManifest } from '../core/routing/index.js';
|
import { createRouteManifest } from '../core/routing/index.js';
|
||||||
import { baseMiddleware } from './base.js';
|
import { baseMiddleware } from './base.js';
|
||||||
import { createController } from './controller.js';
|
import { createController } from './controller.js';
|
||||||
import { handleRequest } from './request.js';
|
|
||||||
import DevPipeline from './devPipeline.js';
|
import DevPipeline from './devPipeline.js';
|
||||||
|
import { handleRequest } from './request.js';
|
||||||
|
|
||||||
export interface AstroPluginOptions {
|
export interface AstroPluginOptions {
|
||||||
settings: AstroSettings;
|
settings: AstroSettings;
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
import type http from 'node:http';
|
import type http from 'node:http';
|
||||||
import type { ManifestData, SSRManifest } from '../@types/astro';
|
import type { ManifestData, SSRManifest } from '../@types/astro';
|
||||||
import type { DevServerController } from './controller';
|
|
||||||
import { collectErrorMetadata } from '../core/errors/dev/index.js';
|
import { collectErrorMetadata } from '../core/errors/dev/index.js';
|
||||||
import { createSafeError } from '../core/errors/index.js';
|
import { createSafeError } from '../core/errors/index.js';
|
||||||
import * as msg from '../core/messages.js';
|
import * as msg from '../core/messages.js';
|
||||||
import { collapseDuplicateSlashes, removeTrailingForwardSlash } from '../core/path.js';
|
import { collapseDuplicateSlashes, removeTrailingForwardSlash } from '../core/path.js';
|
||||||
import { eventError, telemetry } from '../events/index.js';
|
import { eventError, telemetry } from '../events/index.js';
|
||||||
import { isServerLikeOutput } from '../prerender/utils.js';
|
import { isServerLikeOutput } from '../prerender/utils.js';
|
||||||
|
import type { DevServerController } from './controller';
|
||||||
import { runWithErrorHandling } from './controller.js';
|
import { runWithErrorHandling } from './controller.js';
|
||||||
|
import type DevPipeline from './devPipeline';
|
||||||
import { handle500Response } from './response.js';
|
import { handle500Response } from './response.js';
|
||||||
import { handleRoute, matchRoute } from './route.js';
|
import { handleRoute, matchRoute } from './route.js';
|
||||||
import type DevPipeline from './devPipeline';
|
|
||||||
|
|
||||||
type HandleRequest = {
|
type HandleRequest = {
|
||||||
pipeline: DevPipeline;
|
pipeline: DevPipeline;
|
||||||
|
|
|
@ -18,11 +18,11 @@ import { isServerLikeOutput } from '../prerender/utils.js';
|
||||||
import { PAGE_SCRIPT_ID } from '../vite-plugin-scripts/index.js';
|
import { PAGE_SCRIPT_ID } from '../vite-plugin-scripts/index.js';
|
||||||
import { log404 } from './common.js';
|
import { log404 } from './common.js';
|
||||||
import { getStylesForURL } from './css.js';
|
import { getStylesForURL } from './css.js';
|
||||||
|
import type DevPipeline from './devPipeline.js';
|
||||||
import { preload } from './index.js';
|
import { preload } from './index.js';
|
||||||
import { getComponentMetadata } from './metadata.js';
|
import { getComponentMetadata } from './metadata.js';
|
||||||
import { handle404Response, writeSSRResult, writeWebResponse } from './response.js';
|
import { handle404Response, writeSSRResult, writeWebResponse } from './response.js';
|
||||||
import { getScriptsForURL } from './scripts.js';
|
import { getScriptsForURL } from './scripts.js';
|
||||||
import type DevPipeline from './devPipeline.js';
|
|
||||||
|
|
||||||
const clientLocalsSymbol = Symbol.for('astro.locals');
|
const clientLocalsSymbol = Symbol.for('astro.locals');
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { toRemarkInitializeAstroData } from '@astrojs/markdown-remark/dist/inter
|
||||||
import { compile as mdxCompile, type CompileOptions } from '@mdx-js/mdx';
|
import { compile as mdxCompile, type CompileOptions } from '@mdx-js/mdx';
|
||||||
import type { PluggableList } from '@mdx-js/mdx/lib/core.js';
|
import type { PluggableList } from '@mdx-js/mdx/lib/core.js';
|
||||||
import type { AstroIntegration, ContentEntryType, HookParameters } from 'astro';
|
import type { AstroIntegration, ContentEntryType, HookParameters } from 'astro';
|
||||||
|
import astroJSXRenderer from 'astro/jsx/renderer.js';
|
||||||
import { parse as parseESM } from 'es-module-lexer';
|
import { parse as parseESM } from 'es-module-lexer';
|
||||||
import fs from 'node:fs/promises';
|
import fs from 'node:fs/promises';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
|
@ -13,7 +14,6 @@ import type { Plugin as VitePlugin } from 'vite';
|
||||||
import { getRehypePlugins, getRemarkPlugins, recmaInjectImportMetaEnvPlugin } from './plugins.js';
|
import { getRehypePlugins, getRemarkPlugins, recmaInjectImportMetaEnvPlugin } from './plugins.js';
|
||||||
import type { OptimizeOptions } from './rehype-optimize-static.js';
|
import type { OptimizeOptions } from './rehype-optimize-static.js';
|
||||||
import { getFileInfo, ignoreStringPlugins, parseFrontmatter } from './utils.js';
|
import { getFileInfo, ignoreStringPlugins, parseFrontmatter } from './utils.js';
|
||||||
import astroJSXRenderer from 'astro/jsx/renderer.js';
|
|
||||||
|
|
||||||
export type MdxOptions = Omit<typeof markdownConfigDefaults, 'remarkPlugins' | 'rehypePlugins'> & {
|
export type MdxOptions = Omit<typeof markdownConfigDefaults, 'remarkPlugins' | 'rehypePlugins'> & {
|
||||||
extendMarkdownConfig: boolean;
|
extendMarkdownConfig: boolean;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { AstroIntegration, AstroRenderer, ViteUserConfig } from 'astro';
|
|
||||||
import preact, { type PreactPluginOptions as VitePreactPluginOptions } from '@preact/preset-vite';
|
import preact, { type PreactPluginOptions as VitePreactPluginOptions } from '@preact/preset-vite';
|
||||||
|
import type { AstroIntegration, AstroRenderer, ViteUserConfig } from 'astro';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
const babelCwd = new URL('../', import.meta.url);
|
const babelCwd = new URL('../', import.meta.url);
|
||||||
|
|
|
@ -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 type { AstroIntegration } from 'astro';
|
||||||
import { version as ReactVersion } from 'react-dom';
|
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';
|
import type * as vite from 'vite';
|
||||||
|
|
||||||
export type ReactIntegrationOptions = Pick<ViteReactPluginOptions, 'include' | 'exclude'> & {
|
export type ReactIntegrationOptions = Pick<ViteReactPluginOptions, 'include' | 'exclude'> & {
|
||||||
|
|
Loading…
Reference in a new issue