Compare commits
2 commits
main
...
feat/no-ba
Author | SHA1 | Date | |
---|---|---|---|
|
797b121465 | ||
|
27875ae0e9 |
81 changed files with 131 additions and 177 deletions
|
@ -16,9 +16,9 @@ import type * as vite from 'vite';
|
||||||
import type { RemotePattern } from '../assets/utils/remotePattern.js';
|
import type { RemotePattern } from '../assets/utils/remotePattern.js';
|
||||||
import type { SerializedSSRManifest } from '../core/app/types.js';
|
import type { SerializedSSRManifest } from '../core/app/types.js';
|
||||||
import type { PageBuildData } from '../core/build/types.js';
|
import type { PageBuildData } from '../core/build/types.js';
|
||||||
import type { AstroConfigType } from '../core/config/index.js';
|
import type { AstroConfigType } from '../core/config/schema.js';
|
||||||
import type { AstroTimer } from '../core/config/timer.js';
|
import type { AstroTimer } from '../core/config/timer.js';
|
||||||
import type { AstroCookies } from '../core/cookies/index.js';
|
import type { AstroCookies } from '../core/cookies/cookies.js';
|
||||||
import type { ResponseWithEncoding } from '../core/endpoint/index.js';
|
import type { ResponseWithEncoding } from '../core/endpoint/index.js';
|
||||||
import type { AstroIntegrationLogger, Logger, LoggerLevel } from '../core/logger/core.js';
|
import type { AstroIntegrationLogger, Logger, LoggerLevel } from '../core/logger/core.js';
|
||||||
import type { AstroComponentFactory, AstroComponentInstance } from '../runtime/server/index.js';
|
import type { AstroComponentFactory, AstroComponentInstance } from '../runtime/server/index.js';
|
||||||
|
@ -52,7 +52,7 @@ export type {
|
||||||
} from '../assets/types.js';
|
} from '../assets/types.js';
|
||||||
export type { RemotePattern } from '../assets/utils/remotePattern.js';
|
export type { RemotePattern } from '../assets/utils/remotePattern.js';
|
||||||
export type { SSRManifest } from '../core/app/types.js';
|
export type { SSRManifest } from '../core/app/types.js';
|
||||||
export type { AstroCookies } from '../core/cookies/index.js';
|
export type { AstroCookies };
|
||||||
|
|
||||||
export interface AstroBuiltinProps {
|
export interface AstroBuiltinProps {
|
||||||
'client:load'?: boolean;
|
'client:load'?: boolean;
|
||||||
|
|
|
@ -9,14 +9,10 @@ import ora from 'ora';
|
||||||
import preferredPM from 'preferred-pm';
|
import preferredPM from 'preferred-pm';
|
||||||
import prompts from 'prompts';
|
import prompts from 'prompts';
|
||||||
import type yargs from 'yargs-parser';
|
import type yargs from 'yargs-parser';
|
||||||
import {
|
import { resolveConfig, resolveConfigPath, resolveRoot } from '../../core/config/config.js';
|
||||||
loadTSConfig,
|
|
||||||
resolveConfig,
|
|
||||||
resolveConfigPath,
|
|
||||||
resolveRoot,
|
|
||||||
} from '../../core/config/index.js';
|
|
||||||
import {
|
import {
|
||||||
defaultTSConfig,
|
defaultTSConfig,
|
||||||
|
loadTSConfig,
|
||||||
presets,
|
presets,
|
||||||
updateTSConfigForFramework,
|
updateTSConfigForFramework,
|
||||||
type frameworkWithTSSettings,
|
type frameworkWithTSSettings,
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { cyan } from 'kleur/colors';
|
import { cyan } from 'kleur/colors';
|
||||||
import type yargs from 'yargs-parser';
|
import type yargs from 'yargs-parser';
|
||||||
import devServer from '../../core/dev/index.js';
|
import devServer from '../../core/dev/dev.js';
|
||||||
import { printHelp } from '../../core/messages.js';
|
import { printHelp } from '../../core/messages.js';
|
||||||
import { flagsToAstroInlineConfig } from '../flags.js';
|
import { flagsToAstroInlineConfig } from '../flags.js';
|
||||||
|
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { execSync } from 'node:child_process';
|
||||||
import { arch, platform } from 'node:os';
|
import { arch, platform } from 'node:os';
|
||||||
import prompts from 'prompts';
|
import prompts from 'prompts';
|
||||||
import type yargs from 'yargs-parser';
|
import type yargs from 'yargs-parser';
|
||||||
import { resolveConfig } from '../../core/config/index.js';
|
import { resolveConfig } from '../../core/config/config.js';
|
||||||
import { ASTRO_VERSION } from '../../core/constants.js';
|
import { ASTRO_VERSION } from '../../core/constants.js';
|
||||||
import { flagsToAstroInlineConfig } from '../flags.js';
|
import { flagsToAstroInlineConfig } from '../flags.js';
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,8 @@ export function getViteConfig(inlineConfig: UserConfig) {
|
||||||
fs,
|
fs,
|
||||||
{ mergeConfig },
|
{ mergeConfig },
|
||||||
{ nodeLogDestination },
|
{ nodeLogDestination },
|
||||||
{ resolveConfig, createSettings },
|
{ resolveConfig },
|
||||||
|
{ createSettings },
|
||||||
{ createVite },
|
{ createVite },
|
||||||
{ runHookConfigSetup, runHookConfigDone },
|
{ runHookConfigSetup, runHookConfigDone },
|
||||||
{ astroContentListenPlugin },
|
{ astroContentListenPlugin },
|
||||||
|
@ -25,7 +26,8 @@ export function getViteConfig(inlineConfig: UserConfig) {
|
||||||
import('node:fs'),
|
import('node:fs'),
|
||||||
import('vite'),
|
import('vite'),
|
||||||
import('../core/logger/node.js'),
|
import('../core/logger/node.js'),
|
||||||
import('../core/config/index.js'),
|
import('../core/config/config.js'),
|
||||||
|
import('../core/config/settings.js'),
|
||||||
import('../core/create-vite.js'),
|
import('../core/create-vite.js'),
|
||||||
import('../integrations/index.js'),
|
import('../integrations/index.js'),
|
||||||
import('./vite-plugin-content-listen.js'),
|
import('./vite-plugin-content-listen.js'),
|
||||||
|
|
|
@ -1,8 +0,0 @@
|
||||||
export { CONTENT_FLAG, PROPAGATED_ASSET_FLAG } from './consts.js';
|
|
||||||
export { errorMap } from './error-map.js';
|
|
||||||
export { attachContentServerListeners } from './server-listeners.js';
|
|
||||||
export { createContentTypesGenerator } from './types-generator.js';
|
|
||||||
export { contentObservable, getContentPaths, getDotAstroTypeReference } from './utils.js';
|
|
||||||
export { astroContentAssetPropagationPlugin } from './vite-plugin-content-assets.js';
|
|
||||||
export { astroContentImportPlugin } from './vite-plugin-content-imports.js';
|
|
||||||
export { astroContentVirtualModPlugin } from './vite-plugin-content-virtual-mod.js';
|
|
|
@ -7,7 +7,7 @@ import type {
|
||||||
SSRManifest,
|
SSRManifest,
|
||||||
} from '../../@types/astro.js';
|
} from '../../@types/astro.js';
|
||||||
import type { SinglePageBuiltModule } from '../build/types.js';
|
import type { SinglePageBuiltModule } from '../build/types.js';
|
||||||
import { getSetCookiesFromResponse } from '../cookies/index.js';
|
import { getSetCookiesFromResponse } from '../cookies/response.js';
|
||||||
import { consoleLogDestination } from '../logger/console.js';
|
import { consoleLogDestination } from '../logger/console.js';
|
||||||
import { AstroIntegrationLogger, Logger } from '../logger/core.js';
|
import { AstroIntegrationLogger, Logger } from '../logger/core.js';
|
||||||
import {
|
import {
|
||||||
|
@ -15,8 +15,9 @@ import {
|
||||||
prependForwardSlash,
|
prependForwardSlash,
|
||||||
removeTrailingForwardSlash,
|
removeTrailingForwardSlash,
|
||||||
} from '../path.js';
|
} from '../path.js';
|
||||||
import { RedirectSinglePageBuiltModule } from '../redirects/index.js';
|
import { RedirectSinglePageBuiltModule } from '../redirects/component.js';
|
||||||
import { createEnvironment, createRenderContext, type RenderContext } from '../render/index.js';
|
import { createRenderContext, type RenderContext } from '../render/context.js';
|
||||||
|
import { createEnvironment } from '../render/environment.js';
|
||||||
import { RouteCache } from '../render/route-cache.js';
|
import { RouteCache } from '../render/route-cache.js';
|
||||||
import {
|
import {
|
||||||
createAssetLink,
|
createAssetLink,
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Pipeline } from '../pipeline.js';
|
import { Pipeline } from '../pipeline.js';
|
||||||
import type { Environment } from '../render/index.js';
|
import type { Environment } from '../render/environment.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 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'
|
||||||
|
|
|
@ -4,7 +4,7 @@ import { BEFORE_HYDRATION_SCRIPT_ID } from '../../vite-plugin-scripts/index.js';
|
||||||
import type { SSRManifest } from '../app/types.js';
|
import type { SSRManifest } from '../app/types.js';
|
||||||
import { Logger } from '../logger/core.js';
|
import { Logger } from '../logger/core.js';
|
||||||
import { Pipeline } from '../pipeline.js';
|
import { Pipeline } from '../pipeline.js';
|
||||||
import { createEnvironment } from '../render/index.js';
|
import { createEnvironment } from '../render/environment.js';
|
||||||
import { createAssetLink } from '../render/ssr-element.js';
|
import { createAssetLink } from '../render/ssr-element.js';
|
||||||
import type { BuildInternals } from './internal.js';
|
import type { BuildInternals } from './internal.js';
|
||||||
import { ASTRO_PAGE_RESOLVED_MODULE_ID } from './plugins/plugin-pages.js';
|
import { ASTRO_PAGE_RESOLVED_MODULE_ID } from './plugins/plugin-pages.js';
|
||||||
|
|
|
@ -33,8 +33,9 @@ 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 { RedirectSinglePageBuiltModule, getRedirectLocationOrThrow } from '../redirects/index.js';
|
import { RedirectSinglePageBuiltModule } from '../redirects/component.js';
|
||||||
import { createRenderContext } from '../render/index.js';
|
import { getRedirectLocationOrThrow } from '../redirects/validate.js';
|
||||||
|
import { createRenderContext } from '../render/context.js';
|
||||||
import { callGetStaticPaths } from '../render/route-cache.js';
|
import { callGetStaticPaths } from '../render/route-cache.js';
|
||||||
import {
|
import {
|
||||||
createAssetLink,
|
createAssetLink,
|
||||||
|
|
|
@ -27,7 +27,7 @@ import { createVite } from '../create-vite.js';
|
||||||
import { Logger, levels, timerMessage } from '../logger/core.js';
|
import { Logger, levels, timerMessage } from '../logger/core.js';
|
||||||
import { apply as applyPolyfill } from '../polyfill.js';
|
import { apply as applyPolyfill } from '../polyfill.js';
|
||||||
import { RouteCache } from '../render/route-cache.js';
|
import { RouteCache } from '../render/route-cache.js';
|
||||||
import { createRouteManifest } from '../routing/index.js';
|
import { createRouteManifest } from '../routing/manifest/create.js';
|
||||||
import { collectPagesData } from './page-data.js';
|
import { collectPagesData } from './page-data.js';
|
||||||
import { staticBuild, viteBuild } from './static-build.js';
|
import { staticBuild, viteBuild } from './static-build.js';
|
||||||
import type { StaticBuildOptions } from './types.js';
|
import type { StaticBuildOptions } from './types.js';
|
||||||
|
|
|
@ -6,7 +6,7 @@ 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.js';
|
import type { SerializedRouteInfo, SerializedSSRManifest } from '../../app/types.js';
|
||||||
import { joinPaths, prependForwardSlash } from '../../path.js';
|
import { joinPaths, prependForwardSlash } from '../../path.js';
|
||||||
import { serializeRouteData } from '../../routing/index.js';
|
import { serializeRouteData } from '../../routing/manifest/serialization.js';
|
||||||
import { addRollupInput } from '../add-rollup-input.js';
|
import { addRollupInput } from '../add-rollup-input.js';
|
||||||
import { getOutFile, getOutFolder } from '../common.js';
|
import { getOutFile, getOutFolder } from '../common.js';
|
||||||
import { cssOrder, mergeInlineCss, type BuildInternals } from '../internal.js';
|
import { cssOrder, mergeInlineCss, type BuildInternals } from '../internal.js';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
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.js';
|
import type { AstroSettings } from '../../../@types/astro.js';
|
||||||
import { routeIsRedirect } from '../../redirects/index.js';
|
import { routeIsRedirect } from '../../redirects/helpers.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';
|
||||||
import type { AstroBuildPlugin } from '../plugin.js';
|
import type { AstroBuildPlugin } from '../plugin.js';
|
||||||
|
|
|
@ -4,7 +4,7 @@ import type { Plugin as VitePlugin } from 'vite';
|
||||||
import type { AstroAdapter, AstroConfig } from '../../../@types/astro.js';
|
import type { AstroAdapter, AstroConfig } from '../../../@types/astro.js';
|
||||||
import { isFunctionPerRouteEnabled } from '../../../integrations/index.js';
|
import { isFunctionPerRouteEnabled } from '../../../integrations/index.js';
|
||||||
import { isServerLikeOutput } from '../../../prerender/utils.js';
|
import { isServerLikeOutput } from '../../../prerender/utils.js';
|
||||||
import { routeIsRedirect } from '../../redirects/index.js';
|
import { routeIsRedirect } from '../../redirects/helpers.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';
|
||||||
import type { AstroBuildPlugin } from '../plugin.js';
|
import type { AstroBuildPlugin } from '../plugin.js';
|
||||||
|
|
|
@ -19,7 +19,7 @@ import { runHookBuildSetup } 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 { routeIsRedirect } from '../redirects/index.js';
|
import { routeIsRedirect } from '../redirects/helpers.js';
|
||||||
import { getOutDirWithinCwd } from './common.js';
|
import { getOutDirWithinCwd } from './common.js';
|
||||||
import { generatePages } from './generate.js';
|
import { generatePages } from './generate.js';
|
||||||
import { trackPageData } from './internal.js';
|
import { trackPageData } from './internal.js';
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
export { buildClientDirectiveEntrypoint } from './build.js';
|
|
||||||
export { getDefaultClientDirectives } from './default.js';
|
|
|
@ -1,8 +0,0 @@
|
||||||
export {
|
|
||||||
cachedCompilation,
|
|
||||||
getCachedCompileResult,
|
|
||||||
invalidateCompilation,
|
|
||||||
isCached,
|
|
||||||
} from './cache.js';
|
|
||||||
export type { CompileProps, CompileResult } from './compile.js';
|
|
||||||
export type { TransformStyle } from './types.js';
|
|
|
@ -1,6 +0,0 @@
|
||||||
export { resolveConfig, resolveConfigPath, resolveFlags, resolveRoot } from './config.js';
|
|
||||||
export { createNodeLogger } from './logging.js';
|
|
||||||
export { mergeConfig } from './merge.js';
|
|
||||||
export type { AstroConfigType } from './schema.js';
|
|
||||||
export { createSettings } from './settings.js';
|
|
||||||
export { loadTSConfig, updateTSConfigForFramework } from './tsconfig.js';
|
|
|
@ -2,9 +2,9 @@ import yaml from 'js-yaml';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||||
import type { AstroConfig, AstroSettings } from '../../@types/astro.js';
|
import type { AstroConfig, AstroSettings } from '../../@types/astro.js';
|
||||||
import { getContentPaths } from '../../content/index.js';
|
import { getContentPaths } from '../../content/utils.js';
|
||||||
import { markdownContentEntryType } from '../../vite-plugin-markdown/content-entry-type.js';
|
import { markdownContentEntryType } from '../../vite-plugin-markdown/content-entry-type.js';
|
||||||
import { getDefaultClientDirectives } from '../client-directive/index.js';
|
import { getDefaultClientDirectives } from '../client-directive/default.js';
|
||||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||||
import { formatYAMLException, isYAMLException } from '../errors/utils.js';
|
import { formatYAMLException, isYAMLException } from '../errors/utils.js';
|
||||||
import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from './../constants.js';
|
import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from './../constants.js';
|
||||||
|
|
|
@ -1,6 +0,0 @@
|
||||||
export { AstroCookies } from './cookies.js';
|
|
||||||
export {
|
|
||||||
attachCookiesToResponse,
|
|
||||||
getSetCookiesFromResponse,
|
|
||||||
responseHasCookies,
|
|
||||||
} from './response.js';
|
|
|
@ -6,11 +6,9 @@ import { fileURLToPath } from 'node:url';
|
||||||
import * as vite from 'vite';
|
import * as vite from 'vite';
|
||||||
import { crawlFrameworkPkgs } from 'vitefu';
|
import { crawlFrameworkPkgs } from 'vitefu';
|
||||||
import astroAssetsPlugin from '../assets/vite-plugin-assets.js';
|
import astroAssetsPlugin from '../assets/vite-plugin-assets.js';
|
||||||
import {
|
import { astroContentAssetPropagationPlugin } from '../content/vite-plugin-content-assets.js';
|
||||||
astroContentAssetPropagationPlugin,
|
import { astroContentImportPlugin } from '../content/vite-plugin-content-imports.js';
|
||||||
astroContentImportPlugin,
|
import { astroContentVirtualModPlugin } from '../content/vite-plugin-content-virtual-mod.js';
|
||||||
astroContentVirtualModPlugin,
|
|
||||||
} from '../content/index.js';
|
|
||||||
import astroTransitions from '../transitions/vite-plugin-transitions.js';
|
import astroTransitions from '../transitions/vite-plugin-transitions.js';
|
||||||
import astroPostprocessVitePlugin from '../vite-plugin-astro-postprocess/index.js';
|
import astroPostprocessVitePlugin from '../vite-plugin-astro-postprocess/index.js';
|
||||||
import { vitePluginAstroServer } from '../vite-plugin-astro-server/index.js';
|
import { vitePluginAstroServer } from '../vite-plugin-astro-server/index.js';
|
||||||
|
|
|
@ -4,7 +4,7 @@ import type { AddressInfo } from 'node:net';
|
||||||
import { performance } from 'perf_hooks';
|
import { performance } from 'perf_hooks';
|
||||||
import type * as vite from 'vite';
|
import type * as vite from 'vite';
|
||||||
import type { AstroInlineConfig } from '../../@types/astro.js';
|
import type { AstroInlineConfig } from '../../@types/astro.js';
|
||||||
import { attachContentServerListeners } from '../../content/index.js';
|
import { attachContentServerListeners } from '../../content/server-listeners.js';
|
||||||
import { telemetry } from '../../events/index.js';
|
import { telemetry } from '../../events/index.js';
|
||||||
import * as msg from '../messages.js';
|
import * as msg from '../messages.js';
|
||||||
import { startContainer } from './container.js';
|
import { startContainer } from './container.js';
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
export { createContainer, startContainer } from './container.js';
|
|
||||||
export { default } from './dev.js';
|
|
||||||
export { createContainerWithAutomaticRestart } from './restart.js';
|
|
|
@ -3,7 +3,9 @@ import { fileURLToPath } from 'node:url';
|
||||||
import * as vite from 'vite';
|
import * as vite from 'vite';
|
||||||
import type { AstroInlineConfig, AstroSettings } from '../../@types/astro.js';
|
import type { AstroInlineConfig, AstroSettings } from '../../@types/astro.js';
|
||||||
import { eventCliSession, telemetry } from '../../events/index.js';
|
import { eventCliSession, telemetry } from '../../events/index.js';
|
||||||
import { createNodeLogger, createSettings, resolveConfig } from '../config/index.js';
|
import { resolveConfig } from '../config/config.js';
|
||||||
|
import { createNodeLogger } from '../config/logging.js';
|
||||||
|
import { createSettings } from '../config/settings.js';
|
||||||
import { collectErrorMetadata } from '../errors/dev/utils.js';
|
import { collectErrorMetadata } from '../errors/dev/utils.js';
|
||||||
import { isAstroConfigZodError } from '../errors/errors.js';
|
import { isAstroConfigZodError } from '../errors/errors.js';
|
||||||
import { createSafeError } from '../errors/index.js';
|
import { createSafeError } from '../errors/index.js';
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import type { EndpointHandler } from '../../../@types/astro.js';
|
import type { EndpointHandler } from '../../../@types/astro.js';
|
||||||
import { createRenderContext, type SSROptions } from '../../render/index.js';
|
import { createRenderContext } from '../../render/context.js';
|
||||||
|
import type { SSROptions } from '../../render/index.js';
|
||||||
import { callEndpoint } from '../index.js';
|
import { callEndpoint } from '../index.js';
|
||||||
|
|
||||||
export async function call(options: SSROptions) {
|
export async function call(options: SSROptions) {
|
||||||
|
|
|
@ -1,18 +1,20 @@
|
||||||
import mime from 'mime';
|
import mime from 'mime';
|
||||||
import type {
|
import {
|
||||||
APIContext,
|
type APIContext,
|
||||||
EndpointHandler,
|
type EndpointHandler,
|
||||||
EndpointOutput,
|
type EndpointOutput,
|
||||||
MiddlewareEndpointHandler,
|
type MiddlewareEndpointHandler,
|
||||||
MiddlewareHandler,
|
type MiddlewareHandler,
|
||||||
Params,
|
type Params,
|
||||||
} from '../../@types/astro.js';
|
} from '../../@types/astro.js';
|
||||||
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 } from '../cookies/cookies.js';
|
||||||
|
import { attachCookiesToResponse } from '../cookies/response.js';
|
||||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||||
import { callMiddleware } from '../middleware/callMiddleware.js';
|
import { callMiddleware } from '../middleware/callMiddleware.js';
|
||||||
import type { Environment, RenderContext } from '../render/index.js';
|
import type { RenderContext } from '../render/context.js';
|
||||||
|
import type { Environment } from '../render/environment.js';
|
||||||
|
|
||||||
const encoder = new TextEncoder();
|
const encoder = new TextEncoder();
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ import * as fs from 'node:fs';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import { getHighlighter } from 'shiki';
|
import { getHighlighter } from 'shiki';
|
||||||
import type { ErrorPayload } from 'vite';
|
import type { ErrorPayload } from 'vite';
|
||||||
import type { ModuleLoader } from '../../module-loader/index.js';
|
import type { ModuleLoader } from '../../module-loader/loader.js';
|
||||||
import { FailedToLoadModuleSSR, InvalidGlob, MdxIntegrationMissingError } from '../errors-data.js';
|
import { FailedToLoadModuleSSR, InvalidGlob, MdxIntegrationMissingError } from '../errors-data.js';
|
||||||
import { AstroError, type ErrorWithMetadata } from '../errors.js';
|
import { AstroError, type ErrorWithMetadata } from '../errors.js';
|
||||||
import { createSafeError } from '../utils.js';
|
import { createSafeError } from '../utils.js';
|
||||||
|
|
|
@ -4,7 +4,7 @@ import type { AstroInlineConfig } from '../@types/astro.js';
|
||||||
import { default as _build } from './build/index.js';
|
import { default as _build } from './build/index.js';
|
||||||
import { default as _sync } from './sync/index.js';
|
import { default as _sync } from './sync/index.js';
|
||||||
|
|
||||||
export { default as dev } from './dev/index.js';
|
export { default as dev } from './dev/dev.js';
|
||||||
export { default as preview } from './preview/index.js';
|
export { default as preview } from './preview/index.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -5,9 +5,9 @@ import type {
|
||||||
MiddlewareHandler,
|
MiddlewareHandler,
|
||||||
MiddlewareNext,
|
MiddlewareNext,
|
||||||
} from '../../@types/astro.js';
|
} from '../../@types/astro.js';
|
||||||
import { attachCookiesToResponse, responseHasCookies } from '../cookies/index.js';
|
import { attachCookiesToResponse, responseHasCookies } from '../cookies/response.js';
|
||||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||||
import type { Environment } from '../render/index.js';
|
import type { Environment } from '../render/environment.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility function that is in charge of calling the middleware.
|
* Utility function that is in charge of calling the middleware.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import type { AstroSettings } from '../../@types/astro.js';
|
import type { AstroSettings } from '../../@types/astro.js';
|
||||||
import { MIDDLEWARE_PATH_SEGMENT_NAME } from '../constants.js';
|
import { MIDDLEWARE_PATH_SEGMENT_NAME } from '../constants.js';
|
||||||
import type { ModuleLoader } from '../module-loader/index.js';
|
import type { ModuleLoader } from '../module-loader/loader.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It accepts a module loader and the astro settings, and it attempts to load the middlewares defined in the configuration.
|
* It accepts a module loader and the astro settings, and it attempts to load the middlewares defined in the configuration.
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
export { createLoader } from './loader.js';
|
|
||||||
export type { LoaderEvents, ModuleInfo, ModuleLoader, ModuleNode } from './loader.js';
|
|
||||||
export { createViteLoader } from './vite.js';
|
|
|
@ -7,8 +7,9 @@ import type {
|
||||||
} from '../@types/astro.js';
|
} from '../@types/astro.js';
|
||||||
import { callEndpoint, createAPIContext } from './endpoint/index.js';
|
import { callEndpoint, createAPIContext } from './endpoint/index.js';
|
||||||
import { callMiddleware } from './middleware/callMiddleware.js';
|
import { callMiddleware } from './middleware/callMiddleware.js';
|
||||||
|
import type { RenderContext } from './render/context.js';
|
||||||
import { renderPage } from './render/core.js';
|
import { renderPage } from './render/core.js';
|
||||||
import { type Environment, type RenderContext } from './render/index.js';
|
import type { Environment } from './render/environment.js';
|
||||||
|
|
||||||
type EndpointResultHandler = (
|
type EndpointResultHandler = (
|
||||||
originalRequest: Request,
|
originalRequest: Request,
|
||||||
|
|
|
@ -1,3 +0,0 @@
|
||||||
export { RedirectComponentInstance, RedirectSinglePageBuiltModule } from './component.js';
|
|
||||||
export { redirectRouteGenerate, redirectRouteStatus, routeIsRedirect } from './helpers.js';
|
|
||||||
export { getRedirectLocationOrThrow } from './validate.js';
|
|
|
@ -6,10 +6,14 @@ import type {
|
||||||
MiddlewareResponseHandler,
|
MiddlewareResponseHandler,
|
||||||
} from '../../@types/astro.js';
|
} from '../../@types/astro.js';
|
||||||
import { renderPage as runtimeRenderPage } from '../../runtime/server/index.js';
|
import { renderPage as runtimeRenderPage } from '../../runtime/server/index.js';
|
||||||
import { attachCookiesToResponse } from '../cookies/index.js';
|
import { attachCookiesToResponse } from '../cookies/response.js';
|
||||||
import { callEndpoint, createAPIContext } from '../endpoint/index.js';
|
import { callEndpoint, createAPIContext } from '../endpoint/index.js';
|
||||||
import { callMiddleware } from '../middleware/callMiddleware.js';
|
import { callMiddleware } from '../middleware/callMiddleware.js';
|
||||||
import { redirectRouteGenerate, redirectRouteStatus, routeIsRedirect } from '../redirects/index.js';
|
import {
|
||||||
|
redirectRouteGenerate,
|
||||||
|
redirectRouteStatus,
|
||||||
|
routeIsRedirect,
|
||||||
|
} from '../redirects/helpers.js';
|
||||||
import type { RenderContext } from './context.js';
|
import type { RenderContext } from './context.js';
|
||||||
import type { Environment } from './environment.js';
|
import type { Environment } from './environment.js';
|
||||||
import { createResult } from './result.js';
|
import { createResult } from './result.js';
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
import type { AstroMiddlewareInstance, ComponentInstance, RouteData } from '../../@types/astro.js';
|
import type { AstroMiddlewareInstance, ComponentInstance, RouteData } from '../../@types/astro.js';
|
||||||
import type { Environment } from './environment.js';
|
import type { Environment } from './environment.js';
|
||||||
export { createRenderContext } from './context.js';
|
|
||||||
export type { RenderContext } from './context.js';
|
|
||||||
export { tryRenderRoute } from './core.js';
|
|
||||||
export { createEnvironment } from './environment.js';
|
|
||||||
export { getParamsAndProps } from './params-and-props.js';
|
|
||||||
export { loadRenderer } from './renderer.js';
|
|
||||||
|
|
||||||
export type { Environment };
|
|
||||||
|
|
||||||
export interface SSROptions {
|
export interface SSROptions {
|
||||||
/** The environment instance */
|
/** The environment instance */
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import type { ComponentInstance, Params, Props, RouteData } from '../../@types/astro.js';
|
import type { ComponentInstance, Params, Props, RouteData } from '../../@types/astro.js';
|
||||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||||
import type { Logger } from '../logger/core.js';
|
import type { Logger } from '../logger/core.js';
|
||||||
import { routeIsRedirect } from '../redirects/index.js';
|
import { routeIsRedirect } from '../redirects/helpers.js';
|
||||||
import { getParams } from '../routing/params.js';
|
import { getParams } from '../routing/params.js';
|
||||||
import { RouteCache, callGetStaticPaths, findPathItemByKey } from './route-cache.js';
|
import { RouteCache, callGetStaticPaths, findPathItemByKey } from './route-cache.js';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { AstroRenderer, SSRLoadedRenderer } from '../../@types/astro.js';
|
import type { AstroRenderer, SSRLoadedRenderer } from '../../@types/astro.js';
|
||||||
import type { ModuleLoader } from '../module-loader/index.js';
|
import type { ModuleLoader } from '../module-loader/loader.js';
|
||||||
|
|
||||||
export async function loadRenderer(
|
export async function loadRenderer(
|
||||||
renderer: AstroRenderer,
|
renderer: AstroRenderer,
|
||||||
|
|
|
@ -9,7 +9,7 @@ import type {
|
||||||
import { renderSlotToString, type ComponentSlots } from '../../runtime/server/index.js';
|
import { renderSlotToString, type ComponentSlots } from '../../runtime/server/index.js';
|
||||||
import { renderJSX } from '../../runtime/server/jsx.js';
|
import { renderJSX } from '../../runtime/server/jsx.js';
|
||||||
import { chunkToString } from '../../runtime/server/render/index.js';
|
import { chunkToString } from '../../runtime/server/render/index.js';
|
||||||
import { AstroCookies } from '../cookies/index.js';
|
import { AstroCookies } from '../cookies/cookies.js';
|
||||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||||
import type { Logger } from '../logger/core.js';
|
import type { Logger } from '../logger/core.js';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
export { createRouteManifest } from './manifest/create.js';
|
|
||||||
export { deserializeRouteData, serializeRouteData } from './manifest/serialization.js';
|
|
||||||
export { matchAllRoutes, matchRoute } from './match.js';
|
|
||||||
export { getParams } from './params.js';
|
|
||||||
export { validateDynamicRouteModule, validateGetStaticPathsResult } from './validation.js';
|
|
|
@ -4,7 +4,7 @@ import { performance } from 'node:perf_hooks';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import { createServer, type HMRPayload } from 'vite';
|
import { createServer, type HMRPayload } from 'vite';
|
||||||
import type { AstroInlineConfig, AstroSettings } from '../../@types/astro.js';
|
import type { AstroInlineConfig, AstroSettings } from '../../@types/astro.js';
|
||||||
import { createContentTypesGenerator } from '../../content/index.js';
|
import { createContentTypesGenerator } from '../../content/types-generator.js';
|
||||||
import { globalContentConfigObserver } from '../../content/utils.js';
|
import { globalContentConfigObserver } from '../../content/utils.js';
|
||||||
import { telemetry } from '../../events/index.js';
|
import { telemetry } from '../../events/index.js';
|
||||||
import { eventCliSession } from '../../events/session.js';
|
import { eventCliSession } from '../../events/session.js';
|
||||||
|
|
|
@ -5,7 +5,7 @@ import { normalizePath } from 'vite';
|
||||||
import type { AstroConfig, AstroSettings, RouteType } from '../@types/astro.js';
|
import type { AstroConfig, AstroSettings, RouteType } from '../@types/astro.js';
|
||||||
import { isServerLikeOutput } from '../prerender/utils.js';
|
import { isServerLikeOutput } from '../prerender/utils.js';
|
||||||
import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from './constants.js';
|
import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from './constants.js';
|
||||||
import type { ModuleLoader } from './module-loader/index.js';
|
import type { ModuleLoader } from './module-loader/loader.js';
|
||||||
import { prependForwardSlash, removeTrailingForwardSlash, slash } from './path.js';
|
import { prependForwardSlash, removeTrailingForwardSlash, slash } from './path.js';
|
||||||
|
|
||||||
/** Returns true if argument is an object of any prototype/class (but not null). */
|
/** Returns true if argument is an object of any prototype/class (but not null). */
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { bold } from 'kleur/colors';
|
||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import type { AddressInfo } from 'node:net';
|
import type { AddressInfo } from 'node:net';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import type { InlineConfig, ViteDevServer } from 'vite';
|
import { mergeConfig, type InlineConfig, type ViteDevServer } from 'vite';
|
||||||
import type {
|
import type {
|
||||||
AstroAdapter,
|
AstroAdapter,
|
||||||
AstroConfig,
|
AstroConfig,
|
||||||
|
@ -16,8 +16,7 @@ import type {
|
||||||
} from '../@types/astro.js';
|
} from '../@types/astro.js';
|
||||||
import type { SerializedSSRManifest } from '../core/app/types.js';
|
import type { SerializedSSRManifest } from '../core/app/types.js';
|
||||||
import type { PageBuildData } from '../core/build/types.js';
|
import type { PageBuildData } from '../core/build/types.js';
|
||||||
import { buildClientDirectiveEntrypoint } from '../core/client-directive/index.js';
|
import { buildClientDirectiveEntrypoint } from '../core/client-directive/build.js';
|
||||||
import { mergeConfig } from '../core/config/index.js';
|
|
||||||
import { AstroIntegrationLogger, type Logger } from '../core/logger/core.js';
|
import { AstroIntegrationLogger, type Logger } from '../core/logger/core.js';
|
||||||
import { isServerLikeOutput } from '../prerender/utils.js';
|
import { isServerLikeOutput } from '../prerender/utils.js';
|
||||||
import { validateSupportedFeatures } from './astroFeaturesValidation.js';
|
import { validateSupportedFeatures } from './astroFeaturesValidation.js';
|
||||||
|
|
|
@ -1,2 +0,0 @@
|
||||||
export { createAstroJSXComponent } from './component.js';
|
|
||||||
export { default as renderer } from './renderer.js';
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { ModuleInfo, ModuleLoader } from '../core/module-loader/index.js';
|
import type { ModuleInfo, ModuleLoader } from '../core/module-loader/loader.js';
|
||||||
import { viteID } from '../core/util.js';
|
import { viteID } from '../core/util.js';
|
||||||
|
|
||||||
type GetPrerenderStatusParams = {
|
type GetPrerenderStatusParams = {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import type { AstroSettings, ComponentInstance, RouteData } from '../@types/astro.js';
|
import type { AstroSettings, ComponentInstance, RouteData } from '../@types/astro.js';
|
||||||
import { RedirectComponentInstance, routeIsRedirect } from '../core/redirects/index.js';
|
import { RedirectComponentInstance } from '../core/redirects/component.js';
|
||||||
|
import { routeIsRedirect } from '../core/redirects/helpers.js';
|
||||||
import type DevPipeline from '../vite-plugin-astro-server/devPipeline.js';
|
import type DevPipeline from '../vite-plugin-astro-server/devPipeline.js';
|
||||||
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';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { LoaderEvents, ModuleLoader } from '../core/module-loader/index.js';
|
import type { LoaderEvents, ModuleLoader } from '../core/module-loader/loader.js';
|
||||||
import type { ServerState } from './server-state.js';
|
import type { ServerState } from './server-state.js';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { RuntimeMode } from '../@types/astro.js';
|
import type { RuntimeMode } from '../@types/astro.js';
|
||||||
import type { ModuleLoader } from '../core/module-loader/index.js';
|
import type { ModuleLoader } from '../core/module-loader/loader.js';
|
||||||
import { viteID } from '../core/util.js';
|
import { viteID } from '../core/util.js';
|
||||||
import { isBuildableCSSRequest } from './util.js';
|
import { isBuildableCSSRequest } from './util.js';
|
||||||
import { crawlGraph } from './vite.js';
|
import { crawlGraph } from './vite.js';
|
||||||
|
|
|
@ -6,10 +6,10 @@ import type {
|
||||||
SSRManifest,
|
SSRManifest,
|
||||||
} from '../@types/astro.js';
|
} from '../@types/astro.js';
|
||||||
import type { Logger } from '../core/logger/core.js';
|
import type { Logger } from '../core/logger/core.js';
|
||||||
import type { ModuleLoader } from '../core/module-loader/index.js';
|
import type { ModuleLoader } from '../core/module-loader/loader.js';
|
||||||
import { Pipeline } from '../core/pipeline.js';
|
import { Pipeline } from '../core/pipeline.js';
|
||||||
import type { Environment } from '../core/render/index.js';
|
import { createEnvironment, type Environment } from '../core/render/environment.js';
|
||||||
import { createEnvironment, loadRenderer } from '../core/render/index.js';
|
import { loadRenderer } from '../core/render/renderer.js';
|
||||||
import { RouteCache } from '../core/render/route-cache.js';
|
import { RouteCache } from '../core/render/route-cache.js';
|
||||||
import { isServerLikeOutput } from '../prerender/utils.js';
|
import { isServerLikeOutput } from '../prerender/utils.js';
|
||||||
import { createResolve } from './resolve.js';
|
import { createResolve } from './resolve.js';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { SSRComponentMetadata, SSRResult } from '../@types/astro.js';
|
import type { SSRComponentMetadata, SSRResult } from '../@types/astro.js';
|
||||||
import type { ModuleInfo, ModuleLoader } from '../core/module-loader/index.js';
|
import type { ModuleInfo, ModuleLoader } from '../core/module-loader/loader.js';
|
||||||
import { viteID } from '../core/util.js';
|
import { viteID } from '../core/util.js';
|
||||||
import { getAstroMetadata } from '../vite-plugin-astro/index.js';
|
import { getAstroMetadata } from '../vite-plugin-astro/index.js';
|
||||||
import { crawlGraph } from './vite.js';
|
import { crawlGraph } from './vite.js';
|
||||||
|
|
|
@ -3,8 +3,8 @@ import type * as vite from 'vite';
|
||||||
import type { AstroSettings, ManifestData, SSRManifest } from '../@types/astro.js';
|
import type { AstroSettings, ManifestData, SSRManifest } from '../@types/astro.js';
|
||||||
import { patchOverlay } from '../core/errors/overlay.js';
|
import { patchOverlay } from '../core/errors/overlay.js';
|
||||||
import type { Logger } from '../core/logger/core.js';
|
import type { Logger } from '../core/logger/core.js';
|
||||||
import { createViteLoader } from '../core/module-loader/index.js';
|
import { createViteLoader } from '../core/module-loader/vite.js';
|
||||||
import { createRouteManifest } from '../core/routing/index.js';
|
import { createRouteManifest } from '../core/routing/manifest/create.js';
|
||||||
import { baseMiddleware } from './base.js';
|
import { baseMiddleware } from './base.js';
|
||||||
import { createController } from './controller.js';
|
import { createController } from './controller.js';
|
||||||
import DevPipeline from './devPipeline.js';
|
import DevPipeline from './devPipeline.js';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { ModuleLoader } from '../core/module-loader/index.js';
|
import type { ModuleLoader } from '../core/module-loader/loader.js';
|
||||||
import { resolveIdToUrl } from '../core/util.js';
|
import { resolveIdToUrl } from '../core/util.js';
|
||||||
|
|
||||||
export function createResolve(loader: ModuleLoader, root: URL) {
|
export function createResolve(loader: ModuleLoader, root: URL) {
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import type http from 'node:http';
|
import type http from 'node:http';
|
||||||
import type { ErrorWithMetadata } from '../core/errors/index.js';
|
import type { ErrorWithMetadata } from '../core/errors/index.js';
|
||||||
import type { ModuleLoader } from '../core/module-loader/index.js';
|
|
||||||
|
|
||||||
import { Readable } from 'stream';
|
import { Readable } from 'stream';
|
||||||
import { getSetCookiesFromResponse } from '../core/cookies/index.js';
|
import { getSetCookiesFromResponse } from '../core/cookies/response.js';
|
||||||
import { getViteErrorPayload } from '../core/errors/dev/index.js';
|
import { getViteErrorPayload } from '../core/errors/dev/index.js';
|
||||||
|
import type { ModuleLoader } from '../core/module-loader/loader.js';
|
||||||
import notFoundTemplate from '../template/4xx.js';
|
import notFoundTemplate from '../template/4xx.js';
|
||||||
|
|
||||||
export async function handle404Response(
|
export async function handle404Response(
|
||||||
|
|
|
@ -9,9 +9,11 @@ import type {
|
||||||
} from '../@types/astro.js';
|
} from '../@types/astro.js';
|
||||||
import { AstroErrorData, isAstroError } from '../core/errors/index.js';
|
import { AstroErrorData, isAstroError } from '../core/errors/index.js';
|
||||||
import { loadMiddleware } from '../core/middleware/loadMiddleware.js';
|
import { loadMiddleware } from '../core/middleware/loadMiddleware.js';
|
||||||
import { createRenderContext, getParamsAndProps, type SSROptions } from '../core/render/index.js';
|
import { createRenderContext } from '../core/render/context.js';
|
||||||
|
import type { SSROptions } from '../core/render/index.js';
|
||||||
|
import { getParamsAndProps } from '../core/render/params-and-props.js';
|
||||||
import { createRequest } from '../core/request.js';
|
import { createRequest } from '../core/request.js';
|
||||||
import { matchAllRoutes } from '../core/routing/index.js';
|
import { matchAllRoutes } from '../core/routing/match.js';
|
||||||
import { isPage } from '../core/util.js';
|
import { isPage } from '../core/util.js';
|
||||||
import { getSortedPreloadedMatches } from '../prerender/routing.js';
|
import { getSortedPreloadedMatches } from '../prerender/routing.js';
|
||||||
import { isServerLikeOutput } from '../prerender/utils.js';
|
import { isServerLikeOutput } from '../prerender/utils.js';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { SSRElement } from '../@types/astro.js';
|
import type { SSRElement } from '../@types/astro.js';
|
||||||
import type { ModuleInfo, ModuleLoader } from '../core/module-loader/index.js';
|
import type { ModuleInfo, ModuleLoader } from '../core/module-loader/loader.js';
|
||||||
import { createModuleScriptElementWithSrc } from '../core/render/ssr-element.js';
|
import { createModuleScriptElementWithSrc } from '../core/render/ssr-element.js';
|
||||||
import { rootRelativePath, viteID } from '../core/util.js';
|
import { rootRelativePath, viteID } from '../core/util.js';
|
||||||
import type { PluginMetadata as AstroPluginMetadata } from '../vite-plugin-astro/types.js';
|
import type { PluginMetadata as AstroPluginMetadata } from '../vite-plugin-astro/types.js';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import npath from 'node:path';
|
import npath from 'node:path';
|
||||||
import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from '../core/constants.js';
|
import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from '../core/constants.js';
|
||||||
import type { ModuleLoader, ModuleNode } from '../core/module-loader/index.js';
|
import type { ModuleLoader, ModuleNode } from '../core/module-loader/loader.js';
|
||||||
import { unwrapId } from '../core/util.js';
|
import { unwrapId } from '../core/util.js';
|
||||||
import { isCSSRequest } from './util.js';
|
import { isCSSRequest } from './util.js';
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import { transformWithEsbuild, type ESBuildTransformResult } from 'vite';
|
import { transformWithEsbuild, type ESBuildTransformResult } from 'vite';
|
||||||
import type { AstroConfig } from '../@types/astro.js';
|
import type { AstroConfig } from '../@types/astro.js';
|
||||||
import { cachedCompilation, type CompileProps, type CompileResult } from '../core/compile/index.js';
|
import { cachedCompilation } from '../core/compile/cache.js';
|
||||||
|
import type { CompileProps, CompileResult } from '../core/compile/compile.js';
|
||||||
import type { Logger } from '../core/logger/core.js';
|
import type { Logger } from '../core/logger/core.js';
|
||||||
import { getFileInfo } from '../vite-plugin-utils/index.js';
|
import { getFileInfo } from '../vite-plugin-utils/index.js';
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,8 @@
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import type { HmrContext, ModuleNode } from 'vite';
|
import type { HmrContext, ModuleNode } from 'vite';
|
||||||
import type { AstroConfig } from '../@types/astro.js';
|
import type { AstroConfig } from '../@types/astro.js';
|
||||||
import {
|
import { cachedCompilation, invalidateCompilation, isCached } from '../core/compile/cache.js';
|
||||||
cachedCompilation,
|
import type { CompileResult } from '../core/compile/compile.js';
|
||||||
invalidateCompilation,
|
|
||||||
isCached,
|
|
||||||
type CompileResult,
|
|
||||||
} from '../core/compile/index.js';
|
|
||||||
import type { Logger } from '../core/logger/core.js';
|
import type { Logger } from '../core/logger/core.js';
|
||||||
import * as msg from '../core/messages.js';
|
import * as msg from '../core/messages.js';
|
||||||
import { isAstroScript } from './query.js';
|
import { isAstroScript } from './query.js';
|
||||||
|
|
|
@ -5,11 +5,8 @@ import type { Logger } from '../core/logger/core.js';
|
||||||
import type { PluginMetadata as AstroPluginMetadata } from './types.js';
|
import type { PluginMetadata as AstroPluginMetadata } from './types.js';
|
||||||
|
|
||||||
import { normalizePath } from 'vite';
|
import { normalizePath } from 'vite';
|
||||||
import {
|
import { cachedCompilation, getCachedCompileResult } from '../core/compile/cache.js';
|
||||||
cachedCompilation,
|
import type { CompileProps } from '../core/compile/compile.js';
|
||||||
getCachedCompileResult,
|
|
||||||
type CompileProps,
|
|
||||||
} from '../core/compile/index.js';
|
|
||||||
import { isRelativePath } from '../core/path.js';
|
import { isRelativePath } from '../core/path.js';
|
||||||
import { normalizeFilename } from '../vite-plugin-utils/index.js';
|
import { normalizeFilename } from '../vite-plugin-utils/index.js';
|
||||||
import { cachedFullCompilation } from './compile.js';
|
import { cachedFullCompilation } from './compile.js';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { ModuleInfo } from '../core/module-loader/index.js';
|
import type { ModuleInfo } from '../core/module-loader/loader.js';
|
||||||
import type { PluginMetadata } from './types.js';
|
import type { PluginMetadata } from './types.js';
|
||||||
|
|
||||||
export function getAstroMetadata(modInfo: ModuleInfo): PluginMetadata['astro'] | undefined {
|
export function getAstroMetadata(modInfo: ModuleInfo): PluginMetadata['astro'] | undefined {
|
||||||
|
|
|
@ -4,7 +4,7 @@ import path from 'node:path';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import { normalizePath, type Plugin } from 'vite';
|
import { normalizePath, type Plugin } from 'vite';
|
||||||
import type { AstroSettings } from '../@types/astro.js';
|
import type { AstroSettings } from '../@types/astro.js';
|
||||||
import { getContentPaths, getDotAstroTypeReference } from '../content/index.js';
|
import { getContentPaths, getDotAstroTypeReference } from '../content/utils.js';
|
||||||
import { type Logger } from '../core/logger/core.js';
|
import { type Logger } from '../core/logger/core.js';
|
||||||
|
|
||||||
export function getEnvTsPath({ srcDir }: { srcDir: URL }) {
|
export function getEnvTsPath({ srcDir }: { srcDir: URL }) {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import type { Logger } from '../core/logger/core.js';
|
||||||
import type { PluginMetadata } from '../vite-plugin-astro/types.js';
|
import type { PluginMetadata } from '../vite-plugin-astro/types.js';
|
||||||
|
|
||||||
import babel from '@babel/core';
|
import babel from '@babel/core';
|
||||||
import { CONTENT_FLAG, PROPAGATED_ASSET_FLAG } from '../content/index.js';
|
import { CONTENT_FLAG, PROPAGATED_ASSET_FLAG } from '../content/consts.js';
|
||||||
import { astroEntryPrefix } from '../core/build/plugins/plugin-component-entry.js';
|
import { astroEntryPrefix } from '../core/build/plugins/plugin-component-entry.js';
|
||||||
import { removeQueryString } from '../core/path.js';
|
import { removeQueryString } from '../core/path.js';
|
||||||
import tagExportsPlugin from './tag.js';
|
import tagExportsPlugin from './tag.js';
|
||||||
|
|
|
@ -12,7 +12,8 @@ import sync from '../dist/core/sync/index.js';
|
||||||
import { RESOLVED_SPLIT_MODULE_ID } from '../dist/core/build/plugins/plugin-ssr.js';
|
import { RESOLVED_SPLIT_MODULE_ID } from '../dist/core/build/plugins/plugin-ssr.js';
|
||||||
import { getVirtualModulePageNameFromPath } from '../dist/core/build/plugins/util.js';
|
import { getVirtualModulePageNameFromPath } from '../dist/core/build/plugins/util.js';
|
||||||
import { makeSplitEntryPointFileName } from '../dist/core/build/static-build.js';
|
import { makeSplitEntryPointFileName } from '../dist/core/build/static-build.js';
|
||||||
import { mergeConfig, resolveConfig } from '../dist/core/config/index.js';
|
import { resolveConfig } from '../dist/core/config/config.js';
|
||||||
|
import { mergeConfig } from "../dist/core/config/merge.js";
|
||||||
import { nodeLogDestination } from '../dist/core/logger/node.js';
|
import { nodeLogDestination } from '../dist/core/logger/node.js';
|
||||||
|
|
||||||
// Disable telemetry when running tests
|
// Disable telemetry when running tests
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import { resolveConfig } from 'vite';
|
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
import { cachedCompilation } from '../../../dist/core/compile/index.js';
|
|
||||||
import { AggregateError } from '../../../dist/core/errors/index.js';
|
|
||||||
import { pathToFileURL } from 'node:url';
|
import { pathToFileURL } from 'node:url';
|
||||||
|
import { resolveConfig } from 'vite';
|
||||||
|
import { cachedCompilation } from '../../../dist/core/compile/cache.js';
|
||||||
|
import { AggregateError } from '../../../dist/core/errors/index.js';
|
||||||
|
|
||||||
describe('astro/src/core/compile', () => {
|
describe('astro/src/core/compile', () => {
|
||||||
describe('Invalid CSS', () => {
|
describe('Invalid CSS', () => {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import { resolveConfig } from '../../../dist/core/config/index.js';
|
import { resolveConfig } from '../../../dist/core/config/config.js';
|
||||||
|
|
||||||
describe('resolveConfig', () => {
|
describe('resolveConfig', () => {
|
||||||
it('resolves relative inline root correctly', async () => {
|
it('resolves relative inline root correctly', async () => {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import { flagsToAstroInlineConfig } from '../../../dist/cli/flags.js';
|
import { flagsToAstroInlineConfig } from '../../../dist/cli/flags.js';
|
||||||
import { resolveConfig } from '../../../dist/core/config/index.js';
|
import { resolveConfig } from '../../../dist/core/config/config.js';
|
||||||
|
|
||||||
const cwd = fileURLToPath(new URL('../../fixtures/config-host/', import.meta.url));
|
const cwd = fileURLToPath(new URL('../../fixtures/config-host/', import.meta.url));
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import { loadTSConfig, updateTSConfigForFramework } from '../../../dist/core/config/index.js';
|
import { loadTSConfig, updateTSConfigForFramework } from '../../../dist/core/config/tsconfig.js';
|
||||||
import * as path from 'node:path';
|
import * as path from 'node:path';
|
||||||
import * as tsr from 'tsconfig-resolver';
|
import * as tsr from 'tsconfig-resolver';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { z } from '../../../zod.mjs';
|
import { z } from '../../../zod.mjs';
|
||||||
import { errorMap } from '../../../dist/content/index.js';
|
import { errorMap } from '../../../dist/content/error-map.js';
|
||||||
import { fixLineEndings } from '../../test-utils.js';
|
import { fixLineEndings } from '../../test-utils.js';
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ import { fileURLToPath } from 'node:url';
|
||||||
import nodeFS from 'node:fs';
|
import nodeFS from 'node:fs';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
|
|
||||||
import { attachContentServerListeners } from '../../../dist/content/index.js';
|
import { attachContentServerListeners } from '../../../dist/content/server-listeners.js';
|
||||||
import { createFs, runInContainer, triggerFSEvent } from '../test-utils.js';
|
import { createFs, runInContainer, triggerFSEvent } from '../test-utils.js';
|
||||||
|
|
||||||
const root = new URL('../../fixtures/alias/', import.meta.url);
|
const root = new URL('../../fixtures/alias/', import.meta.url);
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
import { AstroCookies } from '../../../dist/core/cookies/index.js';
|
import { AstroCookies } from '../../../dist/core/cookies/cookies.js';
|
||||||
import { apply as applyPolyfill } from '../../../dist/core/polyfill.js';
|
import { apply as applyPolyfill } from '../../../dist/core/polyfill.js';
|
||||||
|
|
||||||
applyPolyfill();
|
applyPolyfill();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
import { AstroCookies } from '../../../dist/core/cookies/index.js';
|
import { AstroCookies } from '../../../dist/core/cookies/cookies.js';
|
||||||
import { apply as applyPolyfill } from '../../../dist/core/polyfill.js';
|
import { apply as applyPolyfill } from '../../../dist/core/polyfill.js';
|
||||||
|
|
||||||
applyPolyfill();
|
applyPolyfill();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
import { AstroCookies } from '../../../dist/core/cookies/index.js';
|
import { AstroCookies } from '../../../dist/core/cookies/cookies.js';
|
||||||
import { apply as applyPolyfill } from '../../../dist/core/polyfill.js';
|
import { apply as applyPolyfill } from '../../../dist/core/polyfill.js';
|
||||||
|
|
||||||
applyPolyfill();
|
applyPolyfill();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
import { AstroCookies } from '../../../dist/core/cookies/index.js';
|
import { AstroCookies } from '../../../dist/core/cookies/cookies.js';
|
||||||
import { apply as applyPolyfill } from '../../../dist/core/polyfill.js';
|
import { apply as applyPolyfill } from '../../../dist/core/polyfill.js';
|
||||||
|
|
||||||
applyPolyfill();
|
applyPolyfill();
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
import { AstroCookies } from '../../../dist/core/cookies/index.js';
|
import { AstroCookies } from '../../../dist/core/cookies/cookies.js';
|
||||||
import { apply as applyPolyfill } from '../../../dist/core/polyfill.js';
|
import { apply as applyPolyfill } from '../../../dist/core/polyfill.js';
|
||||||
|
|
||||||
applyPolyfill();
|
applyPolyfill();
|
||||||
|
|
|
@ -3,9 +3,9 @@ import * as cheerio from 'cheerio';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
createContainerWithAutomaticRestart,
|
|
||||||
startContainer,
|
startContainer,
|
||||||
} from '../../../dist/core/dev/index.js';
|
} from '../../../dist/core/dev/container.js';
|
||||||
|
import { createContainerWithAutomaticRestart } from '../../../dist/core/dev/restart.js';
|
||||||
import { createFs, createRequestAndResponse, triggerFSEvent } from '../test-utils.js';
|
import { createFs, createRequestAndResponse, triggerFSEvent } from '../test-utils.js';
|
||||||
|
|
||||||
const root = new URL('../../fixtures/alias/', import.meta.url);
|
const root = new URL('../../fixtures/alias/', import.meta.url);
|
||||||
|
|
|
@ -9,7 +9,8 @@ import {
|
||||||
renderHead,
|
renderHead,
|
||||||
Fragment,
|
Fragment,
|
||||||
} from '../../../dist/runtime/server/index.js';
|
} from '../../../dist/runtime/server/index.js';
|
||||||
import { createRenderContext, tryRenderRoute } from '../../../dist/core/render/index.js';
|
import { createRenderContext } from '../../../dist/core/render/context.js';
|
||||||
|
import { tryRenderRoute } from "../../../dist/core/render/core.js";
|
||||||
import { createBasicEnvironment } from '../test-utils.js';
|
import { createBasicEnvironment } from '../test-utils.js';
|
||||||
import * as cheerio from 'cheerio';
|
import * as cheerio from 'cheerio';
|
||||||
|
|
||||||
|
|
|
@ -8,10 +8,11 @@ import {
|
||||||
import { jsx } from '../../../dist/jsx-runtime/index.js';
|
import { jsx } from '../../../dist/jsx-runtime/index.js';
|
||||||
import {
|
import {
|
||||||
createRenderContext,
|
createRenderContext,
|
||||||
tryRenderRoute,
|
} from '../../../dist/core/render/context.js';
|
||||||
loadRenderer,
|
import { tryRenderRoute } from "../../../dist/core/render/core.js";
|
||||||
} from '../../../dist/core/render/index.js';
|
import { loadRenderer } from '../../../dist/core/render/renderer.js';
|
||||||
import { createAstroJSXComponent, renderer as jsxRenderer } from '../../../dist/jsx/index.js';
|
import { createAstroJSXComponent } from '../../../dist/jsx/component.js';
|
||||||
|
import { default as jsxRenderer } from "../../../dist/jsx/renderer.js";
|
||||||
import { createBasicEnvironment } from '../test-utils.js';
|
import { createBasicEnvironment } from '../test-utils.js';
|
||||||
|
|
||||||
const createAstroModule = (AstroComponent) => ({ default: AstroComponent });
|
const createAstroModule = (AstroComponent) => ({ default: AstroComponent });
|
||||||
|
|
|
@ -4,7 +4,8 @@ import {
|
||||||
createRequestAndResponse,
|
createRequestAndResponse,
|
||||||
defaultLogger,
|
defaultLogger,
|
||||||
} from '../test-utils.js';
|
} from '../test-utils.js';
|
||||||
import { createRouteManifest, matchAllRoutes } from '../../../dist/core/routing/index.js';
|
import { createRouteManifest } from '../../../dist/core/routing/manifest/create.js';
|
||||||
|
import { matchAllRoutes } from '../../../dist/core/routing/match.js';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import { createViteLoader } from '../../../dist/core/module-loader/vite.js';
|
import { createViteLoader } from '../../../dist/core/module-loader/vite.js';
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import { createContainer } from '../../../dist/core/dev/index.js';
|
import { createContainer } from '../../../dist/core/dev/container.js';
|
||||||
import { createViteLoader } from '../../../dist/core/module-loader/index.js';
|
import { createViteLoader } from '../../../dist/core/module-loader/vite.js';
|
||||||
import { createBasicSettings, defaultLogger } from '../test-utils.js';
|
import { createBasicSettings, defaultLogger } from '../test-utils.js';
|
||||||
|
|
||||||
const root = new URL('../../fixtures/alias/', import.meta.url);
|
const root = new URL('../../fixtures/alias/', import.meta.url);
|
||||||
|
|
|
@ -4,11 +4,11 @@ import { EventEmitter } from 'node:events';
|
||||||
import realFS from 'node:fs';
|
import realFS from 'node:fs';
|
||||||
import npath from 'node:path';
|
import npath from 'node:path';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import { getDefaultClientDirectives } from '../../dist/core/client-directive/index.js';
|
import { getDefaultClientDirectives } from '../../dist/core/client-directive/default.js';
|
||||||
import { nodeLogDestination } from '../../dist/core/logger/node.js';
|
import { nodeLogDestination } from '../../dist/core/logger/node.js';
|
||||||
import { createEnvironment } from '../../dist/core/render/index.js';
|
import { createEnvironment } from '../../dist/core/render/environment.js';
|
||||||
import { RouteCache } from '../../dist/core/render/route-cache.js';
|
import { RouteCache } from '../../dist/core/render/route-cache.js';
|
||||||
import { resolveConfig } from '../../dist/core/config/index.js';
|
import { resolveConfig } from '../../dist/core/config/config.js';
|
||||||
import { createBaseSettings } from '../../dist/core/config/settings.js';
|
import { createBaseSettings } from '../../dist/core/config/settings.js';
|
||||||
import { createContainer } from '../../dist/core/dev/container.js';
|
import { createContainer } from '../../dist/core/dev/container.js';
|
||||||
import { unixify } from './correct-path.js';
|
import { unixify } from './correct-path.js';
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
import { createLoader } from '../../../dist/core/module-loader/index.js';
|
import { createLoader } from '../../../dist/core/module-loader/loader.js';
|
||||||
import {
|
import {
|
||||||
createController,
|
createController,
|
||||||
runWithErrorHandling,
|
runWithErrorHandling,
|
||||||
} from '../../../dist/vite-plugin-astro-server/index.js';
|
} from '../../../dist/vite-plugin-astro-server/controller.js';
|
||||||
|
|
||||||
describe('vite-plugin-astro-server', () => {
|
describe('vite-plugin-astro-server', () => {
|
||||||
describe('controller', () => {
|
describe('controller', () => {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { expect } from 'chai';
|
import { expect } from 'chai';
|
||||||
import { createLoader } from '../../../dist/core/module-loader/index.js';
|
import { createLoader } from '../../../dist/core/module-loader/loader.js';
|
||||||
import { createRouteManifest } from '../../../dist/core/routing/index.js';
|
import { createRouteManifest } from '../../../dist/core/routing/manifest/create.js';
|
||||||
import { createComponent, render } from '../../../dist/runtime/server/index.js';
|
import { createComponent, render } from '../../../dist/runtime/server/index.js';
|
||||||
import { createController, handleRequest } from '../../../dist/vite-plugin-astro-server/index.js';
|
import { createController, handleRequest } from '../../../dist/vite-plugin-astro-server/index.js';
|
||||||
import {
|
import {
|
||||||
|
|
Loading…
Reference in a new issue