diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index 2217e76f2..9d0ec940f 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -16,9 +16,9 @@ import type * as vite from 'vite'; import type { RemotePattern } from '../assets/utils/remotePattern.js'; import type { SerializedSSRManifest } from '../core/app/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 { AstroCookies } from '../core/cookies/index.js'; +import type { AstroCookies } from '../core/cookies/cookies.js'; import type { ResponseWithEncoding } from '../core/endpoint/index.js'; import type { AstroIntegrationLogger, Logger, LoggerLevel } from '../core/logger/core.js'; import type { AstroComponentFactory, AstroComponentInstance } from '../runtime/server/index.js'; @@ -52,7 +52,7 @@ export type { } from '../assets/types.js'; export type { RemotePattern } from '../assets/utils/remotePattern.js'; export type { SSRManifest } from '../core/app/types.js'; -export type { AstroCookies } from '../core/cookies/index.js'; +export type { AstroCookies }; export interface AstroBuiltinProps { 'client:load'?: boolean; diff --git a/packages/astro/src/assets/index.ts b/packages/astro/src/assets/index.ts deleted file mode 100644 index 9eeccf250..000000000 --- a/packages/astro/src/assets/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { getConfiguredImageService, getImage } from './internal.js'; -export { baseService, isLocalService } from './services/service.js'; -export { type LocalImageProps, type RemoteImageProps } from './types.js'; diff --git a/packages/astro/src/cli/add/index.ts b/packages/astro/src/cli/add/index.ts index afd63716b..9f2b419e7 100644 --- a/packages/astro/src/cli/add/index.ts +++ b/packages/astro/src/cli/add/index.ts @@ -9,14 +9,10 @@ import ora from 'ora'; import preferredPM from 'preferred-pm'; import prompts from 'prompts'; import type yargs from 'yargs-parser'; -import { - loadTSConfig, - resolveConfig, - resolveConfigPath, - resolveRoot, -} from '../../core/config/index.js'; +import { resolveConfig, resolveConfigPath, resolveRoot } from '../../core/config/config.js'; import { defaultTSConfig, + loadTSConfig, presets, updateTSConfigForFramework, type frameworkWithTSSettings, diff --git a/packages/astro/src/cli/dev/index.ts b/packages/astro/src/cli/dev/index.ts index 5db47fb97..daa80f61c 100644 --- a/packages/astro/src/cli/dev/index.ts +++ b/packages/astro/src/cli/dev/index.ts @@ -1,6 +1,6 @@ import { cyan } from 'kleur/colors'; 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 { flagsToAstroInlineConfig } from '../flags.js'; diff --git a/packages/astro/src/cli/info/index.ts b/packages/astro/src/cli/info/index.ts index cfa9aca8f..84be94d37 100644 --- a/packages/astro/src/cli/info/index.ts +++ b/packages/astro/src/cli/info/index.ts @@ -4,7 +4,7 @@ import { execSync } from 'node:child_process'; import { arch, platform } from 'node:os'; import prompts from 'prompts'; 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 { flagsToAstroInlineConfig } from '../flags.js'; diff --git a/packages/astro/src/config/index.ts b/packages/astro/src/config/index.ts index 8625140ea..c5cc7f4e1 100644 --- a/packages/astro/src/config/index.ts +++ b/packages/astro/src/config/index.ts @@ -17,7 +17,8 @@ export function getViteConfig(inlineConfig: UserConfig) { fs, { mergeConfig }, { nodeLogDestination }, - { resolveConfig, createSettings }, + { resolveConfig }, + { createSettings }, { createVite }, { runHookConfigSetup, runHookConfigDone }, { astroContentListenPlugin }, @@ -25,7 +26,8 @@ export function getViteConfig(inlineConfig: UserConfig) { import('node:fs'), import('vite'), 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('../integrations/index.js'), import('./vite-plugin-content-listen.js'), diff --git a/packages/astro/src/content/index.ts b/packages/astro/src/content/index.ts deleted file mode 100644 index 92c8cbdec..000000000 --- a/packages/astro/src/content/index.ts +++ /dev/null @@ -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'; diff --git a/packages/astro/src/core/app/index.ts b/packages/astro/src/core/app/index.ts index 9cf01f82d..ed090e323 100644 --- a/packages/astro/src/core/app/index.ts +++ b/packages/astro/src/core/app/index.ts @@ -7,7 +7,7 @@ import type { SSRManifest, } from '../../@types/astro.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 { AstroIntegrationLogger, Logger } from '../logger/core.js'; import { @@ -15,8 +15,9 @@ import { prependForwardSlash, removeTrailingForwardSlash, } from '../path.js'; -import { RedirectSinglePageBuiltModule } from '../redirects/index.js'; -import { createEnvironment, createRenderContext, type RenderContext } from '../render/index.js'; +import { RedirectSinglePageBuiltModule } from '../redirects/component.js'; +import { createRenderContext, type RenderContext } from '../render/context.js'; +import { createEnvironment } from '../render/environment.js'; import { RouteCache } from '../render/route-cache.js'; import { createAssetLink, diff --git a/packages/astro/src/core/app/ssrPipeline.ts b/packages/astro/src/core/app/ssrPipeline.ts index 94e8c9139..2c629abcd 100644 --- a/packages/astro/src/core/app/ssrPipeline.ts +++ b/packages/astro/src/core/app/ssrPipeline.ts @@ -1,5 +1,5 @@ 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' diff --git a/packages/astro/src/core/build/buildPipeline.ts b/packages/astro/src/core/build/buildPipeline.ts index d38361c36..e9126dca3 100644 --- a/packages/astro/src/core/build/buildPipeline.ts +++ b/packages/astro/src/core/build/buildPipeline.ts @@ -4,7 +4,7 @@ import { BEFORE_HYDRATION_SCRIPT_ID } from '../../vite-plugin-scripts/index.js'; import type { SSRManifest } from '../app/types.js'; import { Logger } from '../logger/core.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 type { BuildInternals } from './internal.js'; import { ASTRO_PAGE_RESOLVED_MODULE_ID } from './plugins/plugin-pages.js'; diff --git a/packages/astro/src/core/build/generate.ts b/packages/astro/src/core/build/generate.ts index a5b316554..794ec7cfa 100644 --- a/packages/astro/src/core/build/generate.ts +++ b/packages/astro/src/core/build/generate.ts @@ -33,8 +33,9 @@ import { runHookBuildGenerated } from '../../integrations/index.js'; import { getOutputDirectory, isServerLikeOutput } from '../../prerender/utils.js'; import { PAGE_SCRIPT_ID } from '../../vite-plugin-scripts/index.js'; import { AstroError, AstroErrorData } from '../errors/index.js'; -import { RedirectSinglePageBuiltModule, getRedirectLocationOrThrow } from '../redirects/index.js'; -import { createRenderContext } from '../render/index.js'; +import { RedirectSinglePageBuiltModule } from '../redirects/component.js'; +import { getRedirectLocationOrThrow } from '../redirects/validate.js'; +import { createRenderContext } from '../render/context.js'; import { callGetStaticPaths } from '../render/route-cache.js'; import { createAssetLink, diff --git a/packages/astro/src/core/build/index.ts b/packages/astro/src/core/build/index.ts index 5f5ae69a1..378d342bc 100644 --- a/packages/astro/src/core/build/index.ts +++ b/packages/astro/src/core/build/index.ts @@ -27,7 +27,7 @@ import { createVite } from '../create-vite.js'; import { Logger, levels, timerMessage } from '../logger/core.js'; import { apply as applyPolyfill } from '../polyfill.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 { staticBuild, viteBuild } from './static-build.js'; import type { StaticBuildOptions } from './types.js'; diff --git a/packages/astro/src/core/build/plugins/plugin-manifest.ts b/packages/astro/src/core/build/plugins/plugin-manifest.ts index 41ceb282c..aa66a52b1 100644 --- a/packages/astro/src/core/build/plugins/plugin-manifest.ts +++ b/packages/astro/src/core/build/plugins/plugin-manifest.ts @@ -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 type { SerializedRouteInfo, SerializedSSRManifest } from '../../app/types.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 { getOutFile, getOutFolder } from '../common.js'; import { cssOrder, mergeInlineCss, type BuildInternals } from '../internal.js'; diff --git a/packages/astro/src/core/build/plugins/plugin-pages.ts b/packages/astro/src/core/build/plugins/plugin-pages.ts index 00401285f..a7796d32f 100644 --- a/packages/astro/src/core/build/plugins/plugin-pages.ts +++ b/packages/astro/src/core/build/plugins/plugin-pages.ts @@ -1,7 +1,7 @@ import { extname } from 'node:path'; import type { Plugin as VitePlugin } from 'vite'; 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 { type BuildInternals } from '../internal.js'; import type { AstroBuildPlugin } from '../plugin.js'; diff --git a/packages/astro/src/core/build/plugins/plugin-ssr.ts b/packages/astro/src/core/build/plugins/plugin-ssr.ts index 1887351b1..c9c3d1130 100644 --- a/packages/astro/src/core/build/plugins/plugin-ssr.ts +++ b/packages/astro/src/core/build/plugins/plugin-ssr.ts @@ -4,7 +4,7 @@ import type { Plugin as VitePlugin } from 'vite'; import type { AstroAdapter, AstroConfig } from '../../../@types/astro.js'; import { isFunctionPerRouteEnabled } from '../../../integrations/index.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 type { BuildInternals } from '../internal.js'; import type { AstroBuildPlugin } from '../plugin.js'; diff --git a/packages/astro/src/core/build/static-build.ts b/packages/astro/src/core/build/static-build.ts index 016e24541..3d4bad4cf 100644 --- a/packages/astro/src/core/build/static-build.ts +++ b/packages/astro/src/core/build/static-build.ts @@ -19,7 +19,7 @@ import { runHookBuildSetup } from '../../integrations/index.js'; import { getOutputDirectory, isServerLikeOutput } from '../../prerender/utils.js'; import { PAGE_SCRIPT_ID } from '../../vite-plugin-scripts/index.js'; import { AstroError, AstroErrorData } from '../errors/index.js'; -import { routeIsRedirect } from '../redirects/index.js'; +import { routeIsRedirect } from '../redirects/helpers.js'; import { getOutDirWithinCwd } from './common.js'; import { generatePages } from './generate.js'; import { trackPageData } from './internal.js'; diff --git a/packages/astro/src/core/client-directive/index.ts b/packages/astro/src/core/client-directive/index.ts deleted file mode 100644 index 7c1a9a71c..000000000 --- a/packages/astro/src/core/client-directive/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { buildClientDirectiveEntrypoint } from './build.js'; -export { getDefaultClientDirectives } from './default.js'; diff --git a/packages/astro/src/core/compile/index.ts b/packages/astro/src/core/compile/index.ts deleted file mode 100644 index 4a2094de7..000000000 --- a/packages/astro/src/core/compile/index.ts +++ /dev/null @@ -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'; diff --git a/packages/astro/src/core/config/index.ts b/packages/astro/src/core/config/index.ts deleted file mode 100644 index 4bb1f0537..000000000 --- a/packages/astro/src/core/config/index.ts +++ /dev/null @@ -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'; diff --git a/packages/astro/src/core/config/settings.ts b/packages/astro/src/core/config/settings.ts index 8b70f6e96..5449ad281 100644 --- a/packages/astro/src/core/config/settings.ts +++ b/packages/astro/src/core/config/settings.ts @@ -2,9 +2,9 @@ import yaml from 'js-yaml'; import path from 'node:path'; import { fileURLToPath, pathToFileURL } from 'node:url'; 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 { getDefaultClientDirectives } from '../client-directive/index.js'; +import { getDefaultClientDirectives } from '../client-directive/default.js'; import { AstroError, AstroErrorData } from '../errors/index.js'; import { formatYAMLException, isYAMLException } from '../errors/utils.js'; import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from './../constants.js'; diff --git a/packages/astro/src/core/cookies/index.ts b/packages/astro/src/core/cookies/index.ts deleted file mode 100644 index c8869f9ae..000000000 --- a/packages/astro/src/core/cookies/index.ts +++ /dev/null @@ -1,6 +0,0 @@ -export { AstroCookies } from './cookies.js'; -export { - attachCookiesToResponse, - getSetCookiesFromResponse, - responseHasCookies, -} from './response.js'; diff --git a/packages/astro/src/core/create-vite.ts b/packages/astro/src/core/create-vite.ts index 3c59b1fb4..b67e64056 100644 --- a/packages/astro/src/core/create-vite.ts +++ b/packages/astro/src/core/create-vite.ts @@ -6,11 +6,9 @@ import { fileURLToPath } from 'node:url'; import * as vite from 'vite'; import { crawlFrameworkPkgs } from 'vitefu'; import astroAssetsPlugin from '../assets/vite-plugin-assets.js'; -import { - astroContentAssetPropagationPlugin, - astroContentImportPlugin, - astroContentVirtualModPlugin, -} from '../content/index.js'; +import { astroContentAssetPropagationPlugin } from '../content/vite-plugin-content-assets.js'; +import { astroContentImportPlugin } from '../content/vite-plugin-content-imports.js'; +import { astroContentVirtualModPlugin } from '../content/vite-plugin-content-virtual-mod.js'; import astroTransitions from '../transitions/vite-plugin-transitions.js'; import astroPostprocessVitePlugin from '../vite-plugin-astro-postprocess/index.js'; import { vitePluginAstroServer } from '../vite-plugin-astro-server/index.js'; diff --git a/packages/astro/src/core/dev/dev.ts b/packages/astro/src/core/dev/dev.ts index 02ba9d872..5475a53a5 100644 --- a/packages/astro/src/core/dev/dev.ts +++ b/packages/astro/src/core/dev/dev.ts @@ -4,7 +4,7 @@ import type { AddressInfo } from 'node:net'; import { performance } from 'perf_hooks'; import type * as vite from 'vite'; 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 * as msg from '../messages.js'; import { startContainer } from './container.js'; diff --git a/packages/astro/src/core/dev/index.ts b/packages/astro/src/core/dev/index.ts deleted file mode 100644 index 47de19bde..000000000 --- a/packages/astro/src/core/dev/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { createContainer, startContainer } from './container.js'; -export { default } from './dev.js'; -export { createContainerWithAutomaticRestart } from './restart.js'; diff --git a/packages/astro/src/core/dev/restart.ts b/packages/astro/src/core/dev/restart.ts index 2d6ba75f3..1d5856de9 100644 --- a/packages/astro/src/core/dev/restart.ts +++ b/packages/astro/src/core/dev/restart.ts @@ -3,7 +3,9 @@ import { fileURLToPath } from 'node:url'; import * as vite from 'vite'; import type { AstroInlineConfig, AstroSettings } from '../../@types/astro.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 { isAstroConfigZodError } from '../errors/errors.js'; import { createSafeError } from '../errors/index.js'; diff --git a/packages/astro/src/core/endpoint/dev/index.ts b/packages/astro/src/core/endpoint/dev/index.ts index 96fe5f3d7..bf5090a8d 100644 --- a/packages/astro/src/core/endpoint/dev/index.ts +++ b/packages/astro/src/core/endpoint/dev/index.ts @@ -1,5 +1,6 @@ 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'; export async function call(options: SSROptions) { diff --git a/packages/astro/src/core/endpoint/index.ts b/packages/astro/src/core/endpoint/index.ts index b62ba8bed..a2761a3e6 100644 --- a/packages/astro/src/core/endpoint/index.ts +++ b/packages/astro/src/core/endpoint/index.ts @@ -1,18 +1,20 @@ import mime from 'mime'; -import type { - APIContext, - EndpointHandler, - EndpointOutput, - MiddlewareEndpointHandler, - MiddlewareHandler, - Params, +import { + type APIContext, + type EndpointHandler, + type EndpointOutput, + type MiddlewareEndpointHandler, + type MiddlewareHandler, + type Params, } from '../../@types/astro.js'; import { renderEndpoint } from '../../runtime/server/index.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 { 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(); diff --git a/packages/astro/src/core/errors/dev/vite.ts b/packages/astro/src/core/errors/dev/vite.ts index 11e7cfe74..47b1e914f 100644 --- a/packages/astro/src/core/errors/dev/vite.ts +++ b/packages/astro/src/core/errors/dev/vite.ts @@ -2,7 +2,7 @@ import * as fs from 'node:fs'; import { fileURLToPath } from 'node:url'; import { getHighlighter } from 'shiki'; 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 { AstroError, type ErrorWithMetadata } from '../errors.js'; import { createSafeError } from '../utils.js'; diff --git a/packages/astro/src/core/index.ts b/packages/astro/src/core/index.ts index 31d868311..9368df085 100644 --- a/packages/astro/src/core/index.ts +++ b/packages/astro/src/core/index.ts @@ -4,7 +4,7 @@ import type { AstroInlineConfig } from '../@types/astro.js'; import { default as _build } from './build/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'; /** diff --git a/packages/astro/src/core/middleware/callMiddleware.ts b/packages/astro/src/core/middleware/callMiddleware.ts index 40513c152..ee5a1a992 100644 --- a/packages/astro/src/core/middleware/callMiddleware.ts +++ b/packages/astro/src/core/middleware/callMiddleware.ts @@ -5,9 +5,9 @@ import type { MiddlewareHandler, MiddlewareNext, } 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 type { Environment } from '../render/index.js'; +import type { Environment } from '../render/environment.js'; /** * Utility function that is in charge of calling the middleware. diff --git a/packages/astro/src/core/middleware/loadMiddleware.ts b/packages/astro/src/core/middleware/loadMiddleware.ts index b8528eb4b..cb0d08a6a 100644 --- a/packages/astro/src/core/middleware/loadMiddleware.ts +++ b/packages/astro/src/core/middleware/loadMiddleware.ts @@ -1,6 +1,6 @@ import type { AstroSettings } from '../../@types/astro.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. diff --git a/packages/astro/src/core/module-loader/index.ts b/packages/astro/src/core/module-loader/index.ts deleted file mode 100644 index 4d21148b6..000000000 --- a/packages/astro/src/core/module-loader/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { createLoader } from './loader.js'; -export type { LoaderEvents, ModuleInfo, ModuleLoader, ModuleNode } from './loader.js'; -export { createViteLoader } from './vite.js'; diff --git a/packages/astro/src/core/pipeline.ts b/packages/astro/src/core/pipeline.ts index 438ff275d..27aa94d43 100644 --- a/packages/astro/src/core/pipeline.ts +++ b/packages/astro/src/core/pipeline.ts @@ -7,8 +7,9 @@ import type { } from '../@types/astro.js'; import { callEndpoint, createAPIContext } from './endpoint/index.js'; import { callMiddleware } from './middleware/callMiddleware.js'; +import type { RenderContext } from './render/context.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 = ( originalRequest: Request, diff --git a/packages/astro/src/core/redirects/index.ts b/packages/astro/src/core/redirects/index.ts deleted file mode 100644 index 4f705afdf..000000000 --- a/packages/astro/src/core/redirects/index.ts +++ /dev/null @@ -1,3 +0,0 @@ -export { RedirectComponentInstance, RedirectSinglePageBuiltModule } from './component.js'; -export { redirectRouteGenerate, redirectRouteStatus, routeIsRedirect } from './helpers.js'; -export { getRedirectLocationOrThrow } from './validate.js'; diff --git a/packages/astro/src/core/render/core.ts b/packages/astro/src/core/render/core.ts index d8c39ec1a..921ce8f0e 100644 --- a/packages/astro/src/core/render/core.ts +++ b/packages/astro/src/core/render/core.ts @@ -6,10 +6,14 @@ import type { MiddlewareResponseHandler, } from '../../@types/astro.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 { 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 { Environment } from './environment.js'; import { createResult } from './result.js'; diff --git a/packages/astro/src/core/render/index.ts b/packages/astro/src/core/render/index.ts index 098b7d024..625b17943 100644 --- a/packages/astro/src/core/render/index.ts +++ b/packages/astro/src/core/render/index.ts @@ -1,13 +1,5 @@ import type { AstroMiddlewareInstance, ComponentInstance, RouteData } from '../../@types/astro.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 { /** The environment instance */ diff --git a/packages/astro/src/core/render/params-and-props.ts b/packages/astro/src/core/render/params-and-props.ts index ac2884a7a..e96f53e81 100644 --- a/packages/astro/src/core/render/params-and-props.ts +++ b/packages/astro/src/core/render/params-and-props.ts @@ -1,7 +1,7 @@ import type { ComponentInstance, Params, Props, RouteData } from '../../@types/astro.js'; import { AstroError, AstroErrorData } from '../errors/index.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 { RouteCache, callGetStaticPaths, findPathItemByKey } from './route-cache.js'; diff --git a/packages/astro/src/core/render/renderer.ts b/packages/astro/src/core/render/renderer.ts index 4b6015bbb..529c7b4dc 100644 --- a/packages/astro/src/core/render/renderer.ts +++ b/packages/astro/src/core/render/renderer.ts @@ -1,5 +1,5 @@ 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( renderer: AstroRenderer, diff --git a/packages/astro/src/core/render/result.ts b/packages/astro/src/core/render/result.ts index 6f8ca9303..9992919a4 100644 --- a/packages/astro/src/core/render/result.ts +++ b/packages/astro/src/core/render/result.ts @@ -9,7 +9,7 @@ import type { import { renderSlotToString, type ComponentSlots } from '../../runtime/server/index.js'; import { renderJSX } from '../../runtime/server/jsx.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 type { Logger } from '../logger/core.js'; diff --git a/packages/astro/src/core/routing/index.ts b/packages/astro/src/core/routing/index.ts deleted file mode 100644 index b568bb121..000000000 --- a/packages/astro/src/core/routing/index.ts +++ /dev/null @@ -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'; diff --git a/packages/astro/src/core/sync/index.ts b/packages/astro/src/core/sync/index.ts index 940ff0524..8d27c50ab 100644 --- a/packages/astro/src/core/sync/index.ts +++ b/packages/astro/src/core/sync/index.ts @@ -4,7 +4,7 @@ import { performance } from 'node:perf_hooks'; import { fileURLToPath } from 'node:url'; import { createServer, type HMRPayload } from 'vite'; 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 { telemetry } from '../../events/index.js'; import { eventCliSession } from '../../events/session.js'; diff --git a/packages/astro/src/core/util.ts b/packages/astro/src/core/util.ts index bcfa9a511..dee165fc6 100644 --- a/packages/astro/src/core/util.ts +++ b/packages/astro/src/core/util.ts @@ -5,7 +5,7 @@ import { normalizePath } from 'vite'; import type { AstroConfig, AstroSettings, RouteType } from '../@types/astro.js'; import { isServerLikeOutput } from '../prerender/utils.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'; /** Returns true if argument is an object of any prototype/class (but not null). */ diff --git a/packages/astro/src/integrations/index.ts b/packages/astro/src/integrations/index.ts index 5485794c5..03dad5b36 100644 --- a/packages/astro/src/integrations/index.ts +++ b/packages/astro/src/integrations/index.ts @@ -2,7 +2,7 @@ import { bold } from 'kleur/colors'; import fs from 'node:fs'; import type { AddressInfo } from 'node:net'; import { fileURLToPath } from 'node:url'; -import type { InlineConfig, ViteDevServer } from 'vite'; +import { mergeConfig, type InlineConfig, type ViteDevServer } from 'vite'; import type { AstroAdapter, AstroConfig, @@ -16,8 +16,7 @@ import type { } from '../@types/astro.js'; import type { SerializedSSRManifest } from '../core/app/types.js'; import type { PageBuildData } from '../core/build/types.js'; -import { buildClientDirectiveEntrypoint } from '../core/client-directive/index.js'; -import { mergeConfig } from '../core/config/index.js'; +import { buildClientDirectiveEntrypoint } from '../core/client-directive/build.js'; import { AstroIntegrationLogger, type Logger } from '../core/logger/core.js'; import { isServerLikeOutput } from '../prerender/utils.js'; import { validateSupportedFeatures } from './astroFeaturesValidation.js'; diff --git a/packages/astro/src/jsx/index.ts b/packages/astro/src/jsx/index.ts deleted file mode 100644 index 2d5904e04..000000000 --- a/packages/astro/src/jsx/index.ts +++ /dev/null @@ -1,2 +0,0 @@ -export { createAstroJSXComponent } from './component.js'; -export { default as renderer } from './renderer.js'; diff --git a/packages/astro/src/prerender/metadata.ts b/packages/astro/src/prerender/metadata.ts index a501cc46f..1a9d38475 100644 --- a/packages/astro/src/prerender/metadata.ts +++ b/packages/astro/src/prerender/metadata.ts @@ -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'; type GetPrerenderStatusParams = { diff --git a/packages/astro/src/prerender/routing.ts b/packages/astro/src/prerender/routing.ts index 1c1b83825..839d51629 100644 --- a/packages/astro/src/prerender/routing.ts +++ b/packages/astro/src/prerender/routing.ts @@ -1,5 +1,6 @@ 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 { preload } from '../vite-plugin-astro-server/index.js'; import { getPrerenderStatus } from './metadata.js'; diff --git a/packages/astro/src/runtime/compiler/index.ts b/packages/astro/src/runtime/compiler/index.ts deleted file mode 100644 index 6123d6199..000000000 --- a/packages/astro/src/runtime/compiler/index.ts +++ /dev/null @@ -1,20 +0,0 @@ -// NOTE: Although this entrypoint is exported, it is internal API and may change at any time. - -export { - Fragment, - addAttribute, - createAstro, - createComponent, - createTransitionScope, - defineScriptVars, - defineStyleVars, - maybeRenderHead, - mergeSlots, - render, - renderComponent, - renderHead, - renderSlot, - renderTransition, - spreadAttributes, - unescapeHTML, -} from '../server/index.js'; diff --git a/packages/astro/src/vite-plugin-astro-server/controller.ts b/packages/astro/src/vite-plugin-astro-server/controller.ts index 279863613..bf858dcd7 100644 --- a/packages/astro/src/vite-plugin-astro-server/controller.ts +++ b/packages/astro/src/vite-plugin-astro-server/controller.ts @@ -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 { diff --git a/packages/astro/src/vite-plugin-astro-server/css.ts b/packages/astro/src/vite-plugin-astro-server/css.ts index 0da51db1e..70e9fc00d 100644 --- a/packages/astro/src/vite-plugin-astro-server/css.ts +++ b/packages/astro/src/vite-plugin-astro-server/css.ts @@ -1,5 +1,5 @@ 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 { isBuildableCSSRequest } from './util.js'; import { crawlGraph } from './vite.js'; diff --git a/packages/astro/src/vite-plugin-astro-server/devPipeline.ts b/packages/astro/src/vite-plugin-astro-server/devPipeline.ts index e16b3d7e2..efae763be 100644 --- a/packages/astro/src/vite-plugin-astro-server/devPipeline.ts +++ b/packages/astro/src/vite-plugin-astro-server/devPipeline.ts @@ -6,10 +6,10 @@ import type { SSRManifest, } from '../@types/astro.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 type { Environment } from '../core/render/index.js'; -import { createEnvironment, loadRenderer } from '../core/render/index.js'; +import { createEnvironment, type Environment } from '../core/render/environment.js'; +import { loadRenderer } from '../core/render/renderer.js'; import { RouteCache } from '../core/render/route-cache.js'; import { isServerLikeOutput } from '../prerender/utils.js'; import { createResolve } from './resolve.js'; diff --git a/packages/astro/src/vite-plugin-astro-server/metadata.ts b/packages/astro/src/vite-plugin-astro-server/metadata.ts index 09e2373cf..6d4d1ed9c 100644 --- a/packages/astro/src/vite-plugin-astro-server/metadata.ts +++ b/packages/astro/src/vite-plugin-astro-server/metadata.ts @@ -1,5 +1,5 @@ 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 { getAstroMetadata } from '../vite-plugin-astro/index.js'; import { crawlGraph } from './vite.js'; diff --git a/packages/astro/src/vite-plugin-astro-server/plugin.ts b/packages/astro/src/vite-plugin-astro-server/plugin.ts index daa1c01e6..a9cc62064 100644 --- a/packages/astro/src/vite-plugin-astro-server/plugin.ts +++ b/packages/astro/src/vite-plugin-astro-server/plugin.ts @@ -3,8 +3,8 @@ import type * as vite from 'vite'; import type { AstroSettings, ManifestData, SSRManifest } from '../@types/astro.js'; import { patchOverlay } from '../core/errors/overlay.js'; import type { Logger } from '../core/logger/core.js'; -import { createViteLoader } from '../core/module-loader/index.js'; -import { createRouteManifest } from '../core/routing/index.js'; +import { createViteLoader } from '../core/module-loader/vite.js'; +import { createRouteManifest } from '../core/routing/manifest/create.js'; import { baseMiddleware } from './base.js'; import { createController } from './controller.js'; import DevPipeline from './devPipeline.js'; diff --git a/packages/astro/src/vite-plugin-astro-server/resolve.ts b/packages/astro/src/vite-plugin-astro-server/resolve.ts index cbeda56b0..953471a06 100644 --- a/packages/astro/src/vite-plugin-astro-server/resolve.ts +++ b/packages/astro/src/vite-plugin-astro-server/resolve.ts @@ -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'; export function createResolve(loader: ModuleLoader, root: URL) { diff --git a/packages/astro/src/vite-plugin-astro-server/response.ts b/packages/astro/src/vite-plugin-astro-server/response.ts index b1c948095..e6f78d2f9 100644 --- a/packages/astro/src/vite-plugin-astro-server/response.ts +++ b/packages/astro/src/vite-plugin-astro-server/response.ts @@ -1,10 +1,10 @@ import type http from 'node:http'; import type { ErrorWithMetadata } from '../core/errors/index.js'; -import type { ModuleLoader } from '../core/module-loader/index.js'; 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 type { ModuleLoader } from '../core/module-loader/loader.js'; import notFoundTemplate from '../template/4xx.js'; export async function handle404Response( diff --git a/packages/astro/src/vite-plugin-astro-server/route.ts b/packages/astro/src/vite-plugin-astro-server/route.ts index 069c2ffe8..a228ab7e0 100644 --- a/packages/astro/src/vite-plugin-astro-server/route.ts +++ b/packages/astro/src/vite-plugin-astro-server/route.ts @@ -9,9 +9,11 @@ import type { } from '../@types/astro.js'; import { AstroErrorData, isAstroError } from '../core/errors/index.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 { matchAllRoutes } from '../core/routing/index.js'; +import { matchAllRoutes } from '../core/routing/match.js'; import { isPage } from '../core/util.js'; import { getSortedPreloadedMatches } from '../prerender/routing.js'; import { isServerLikeOutput } from '../prerender/utils.js'; diff --git a/packages/astro/src/vite-plugin-astro-server/scripts.ts b/packages/astro/src/vite-plugin-astro-server/scripts.ts index 00bc4054b..663c36327 100644 --- a/packages/astro/src/vite-plugin-astro-server/scripts.ts +++ b/packages/astro/src/vite-plugin-astro-server/scripts.ts @@ -1,5 +1,5 @@ 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 { rootRelativePath, viteID } from '../core/util.js'; import type { PluginMetadata as AstroPluginMetadata } from '../vite-plugin-astro/types.js'; diff --git a/packages/astro/src/vite-plugin-astro-server/vite.ts b/packages/astro/src/vite-plugin-astro-server/vite.ts index 6c2bc2497..d90e34e1d 100644 --- a/packages/astro/src/vite-plugin-astro-server/vite.ts +++ b/packages/astro/src/vite-plugin-astro-server/vite.ts @@ -1,6 +1,6 @@ import npath from 'node:path'; 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 { isCSSRequest } from './util.js'; diff --git a/packages/astro/src/vite-plugin-astro/compile.ts b/packages/astro/src/vite-plugin-astro/compile.ts index 768d18d86..78adc4254 100644 --- a/packages/astro/src/vite-plugin-astro/compile.ts +++ b/packages/astro/src/vite-plugin-astro/compile.ts @@ -1,6 +1,7 @@ import { transformWithEsbuild, type ESBuildTransformResult } from 'vite'; 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 { getFileInfo } from '../vite-plugin-utils/index.js'; diff --git a/packages/astro/src/vite-plugin-astro/hmr.ts b/packages/astro/src/vite-plugin-astro/hmr.ts index 6600b2f42..9e11c4612 100644 --- a/packages/astro/src/vite-plugin-astro/hmr.ts +++ b/packages/astro/src/vite-plugin-astro/hmr.ts @@ -1,12 +1,8 @@ import { fileURLToPath } from 'node:url'; import type { HmrContext, ModuleNode } from 'vite'; import type { AstroConfig } from '../@types/astro.js'; -import { - cachedCompilation, - invalidateCompilation, - isCached, - type CompileResult, -} from '../core/compile/index.js'; +import { cachedCompilation, invalidateCompilation, isCached } from '../core/compile/cache.js'; +import type { CompileResult } from '../core/compile/compile.js'; import type { Logger } from '../core/logger/core.js'; import * as msg from '../core/messages.js'; import { isAstroScript } from './query.js'; diff --git a/packages/astro/src/vite-plugin-astro/index.ts b/packages/astro/src/vite-plugin-astro/index.ts index 1649d8069..6d61adcab 100644 --- a/packages/astro/src/vite-plugin-astro/index.ts +++ b/packages/astro/src/vite-plugin-astro/index.ts @@ -5,11 +5,8 @@ import type { Logger } from '../core/logger/core.js'; import type { PluginMetadata as AstroPluginMetadata } from './types.js'; import { normalizePath } from 'vite'; -import { - cachedCompilation, - getCachedCompileResult, - type CompileProps, -} from '../core/compile/index.js'; +import { cachedCompilation, getCachedCompileResult } from '../core/compile/cache.js'; +import type { CompileProps } from '../core/compile/compile.js'; import { isRelativePath } from '../core/path.js'; import { normalizeFilename } from '../vite-plugin-utils/index.js'; import { cachedFullCompilation } from './compile.js'; diff --git a/packages/astro/src/vite-plugin-astro/metadata.ts b/packages/astro/src/vite-plugin-astro/metadata.ts index d0a2b3644..3c308ef5d 100644 --- a/packages/astro/src/vite-plugin-astro/metadata.ts +++ b/packages/astro/src/vite-plugin-astro/metadata.ts @@ -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'; export function getAstroMetadata(modInfo: ModuleInfo): PluginMetadata['astro'] | undefined { diff --git a/packages/astro/src/vite-plugin-inject-env-ts/index.ts b/packages/astro/src/vite-plugin-inject-env-ts/index.ts index d884075ab..4f129a0c4 100644 --- a/packages/astro/src/vite-plugin-inject-env-ts/index.ts +++ b/packages/astro/src/vite-plugin-inject-env-ts/index.ts @@ -4,7 +4,7 @@ import path from 'node:path'; import { fileURLToPath } from 'node:url'; import { normalizePath, type Plugin } from 'vite'; 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'; export function getEnvTsPath({ srcDir }: { srcDir: URL }) { diff --git a/packages/astro/src/vite-plugin-mdx/index.ts b/packages/astro/src/vite-plugin-mdx/index.ts index 5e2ce2a98..48b4b0da9 100644 --- a/packages/astro/src/vite-plugin-mdx/index.ts +++ b/packages/astro/src/vite-plugin-mdx/index.ts @@ -5,7 +5,7 @@ import type { Logger } from '../core/logger/core.js'; import type { PluginMetadata } from '../vite-plugin-astro/types.js'; 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 { removeQueryString } from '../core/path.js'; import tagExportsPlugin from './tag.js';