mirror of
https://github.com/withastro/astro.git
synced 2025-01-13 22:11:20 -05:00
Refactor/types (#11715)
* refactor: types * feat: refactor types * chore: organize imports * fix: remaining references * docs: types * refactor: small changes * chore: changeset
This commit is contained in:
parent
40b95a164d
commit
d74617cbd3
216 changed files with 2074 additions and 2097 deletions
7
.changeset/poor-frogs-dream.md
Normal file
7
.changeset/poor-frogs-dream.md
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
---
|
||||||
|
'astro': major
|
||||||
|
---
|
||||||
|
|
||||||
|
Refactor the exported types from the `astro` module. There should normally be no breaking changes, but if you relied on some previously deprecated types, these might now have been fully removed.
|
||||||
|
|
||||||
|
In most cases, updating your code to move away from previously deprecated APIs in previous versions of Astro should be enough to fix any issues.
|
2
.github/labeler.yml
vendored
2
.github/labeler.yml
vendored
|
@ -40,5 +40,5 @@
|
||||||
- packages/integrations/vue/**
|
- packages/integrations/vue/**
|
||||||
|
|
||||||
'docs pr':
|
'docs pr':
|
||||||
- packages/astro/src/@types/astro.ts
|
- packages/astro/src/types/public/**
|
||||||
- packages/astro/src/core/errors/errors-data.ts
|
- packages/astro/src/core/errors/errors-data.ts
|
||||||
|
|
2
.github/workflows/check.yml
vendored
2
.github/workflows/check.yml
vendored
|
@ -11,7 +11,7 @@ on:
|
||||||
- "examples/**"
|
- "examples/**"
|
||||||
- ".github/workflows/check.yml"
|
- ".github/workflows/check.yml"
|
||||||
- "scripts/smoke/check.js"
|
- "scripts/smoke/check.js"
|
||||||
- "packages/astro/src/@types/astro.ts"
|
- "packages/astro/src/types/public/**"
|
||||||
- "pnpm-lock.yaml"
|
- "pnpm-lock.yaml"
|
||||||
- "packages/astro/types.d.ts"
|
- "packages/astro/types.d.ts"
|
||||||
|
|
||||||
|
|
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -229,7 +229,7 @@ jobs:
|
||||||
filters: |
|
filters: |
|
||||||
docs:
|
docs:
|
||||||
- 'packages/integrations/*/README.md'
|
- 'packages/integrations/*/README.md'
|
||||||
- 'packages/astro/src/@types/astro.ts'
|
- "packages/astro/src/types/public/**"
|
||||||
- 'packages/astro/src/core/errors/errors-data.ts'
|
- 'packages/astro/src/core/errors/errors-data.ts'
|
||||||
|
|
||||||
- name: Build autogenerated docs pages from current astro branch
|
- name: Build autogenerated docs pages from current astro branch
|
||||||
|
|
|
@ -289,7 +289,7 @@ Server-side rendering (SSR) can be complicated. The Astro package (`packages/ast
|
||||||
|
|
||||||
- `components/`: Built-in components to use in your project (e.g. `import Code from 'astro/components/Code.astro'`)
|
- `components/`: Built-in components to use in your project (e.g. `import Code from 'astro/components/Code.astro'`)
|
||||||
- `src/`: Astro source
|
- `src/`: Astro source
|
||||||
- `@types/`: TypeScript types. These are centralized to cut down on circular dependencies
|
- `types/`: TypeScript types. These are centralized to cut down on circular dependencies
|
||||||
- `cli/`: Code that powers the `astro` CLI command
|
- `cli/`: Code that powers the `astro` CLI command
|
||||||
- `core/`: Code that executes **in the top-level scope** (in Node). Within, you’ll find code that powers the `astro build` and `astro dev` commands, as well as top-level SSR code.
|
- `core/`: Code that executes **in the top-level scope** (in Node). Within, you’ll find code that powers the `astro build` and `astro dev` commands, as well as top-level SSR code.
|
||||||
- `runtime/`: Code that executes **in different scopes** (i.e. not in a pure Node context). You’ll have to think about code differently here.
|
- `runtime/`: Code that executes **in different scopes** (i.e. not in a pure Node context). You’ll have to think about code differently here.
|
||||||
|
|
20
packages/astro/astro-jsx.d.ts
vendored
20
packages/astro/astro-jsx.d.ts
vendored
|
@ -17,23 +17,21 @@ declare namespace astroHTML.JSX {
|
||||||
children: {};
|
children: {};
|
||||||
}
|
}
|
||||||
|
|
||||||
interface IntrinsicAttributes
|
interface IntrinsicAttributes extends AstroComponentDirectives, AstroBuiltinAttributes {
|
||||||
extends AstroBuiltinProps,
|
|
||||||
AstroBuiltinAttributes,
|
|
||||||
AstroClientDirectives {
|
|
||||||
slot?: string | undefined | null;
|
slot?: string | undefined | null;
|
||||||
children?: Children;
|
children?: Children;
|
||||||
}
|
}
|
||||||
|
|
||||||
type AstroBuiltinProps = import('./dist/@types/astro.js').AstroBuiltinProps;
|
type AstroComponentDirectives =
|
||||||
type AstroClientDirectives = import('./dist/@types/astro.js').AstroClientDirectives;
|
import('./dist/types/public/elements.js').AstroComponentDirectives;
|
||||||
type AstroBuiltinAttributes = import('./dist/@types/astro.js').AstroBuiltinAttributes;
|
type AstroBuiltinAttributes = import('./dist/types/public/elements.js').AstroBuiltinAttributes;
|
||||||
type AstroDefineVarsAttribute = import('./dist/@types/astro.js').AstroDefineVarsAttribute;
|
type AstroDefineVarsAttribute =
|
||||||
type AstroScriptAttributes = import('./dist/@types/astro.js').AstroScriptAttributes &
|
import('./dist/types/public/elements.js').AstroDefineVarsAttribute;
|
||||||
|
type AstroScriptAttributes = import('./dist/types/public/elements.js').AstroScriptAttributes &
|
||||||
AstroDefineVarsAttribute;
|
AstroDefineVarsAttribute;
|
||||||
type AstroStyleAttributes = import('./dist/@types/astro.js').AstroStyleAttributes &
|
type AstroStyleAttributes = import('./dist/types/public/elements.js').AstroStyleAttributes &
|
||||||
AstroDefineVarsAttribute;
|
AstroDefineVarsAttribute;
|
||||||
type AstroSlotAttributes = import('./dist/@types/astro.js').AstroSlotAttributes;
|
type AstroSlotAttributes = import('./dist/types/public/elements.js').AstroSlotAttributes;
|
||||||
|
|
||||||
// This is an unfortunate use of `any`, but unfortunately we can't make a type that works for every framework
|
// This is an unfortunate use of `any`, but unfortunately we can't make a type that works for every framework
|
||||||
// without importing every single framework's types (which comes with its own set of problems).
|
// without importing every single framework's types (which comes with its own set of problems).
|
||||||
|
|
20
packages/astro/client.d.ts
vendored
20
packages/astro/client.d.ts
vendored
|
@ -2,12 +2,6 @@
|
||||||
/// <reference path="./types/content.d.ts" />
|
/// <reference path="./types/content.d.ts" />
|
||||||
/// <reference path="./types/actions.d.ts" />
|
/// <reference path="./types/actions.d.ts" />
|
||||||
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-namespace
|
|
||||||
declare namespace App {
|
|
||||||
// eslint-disable-next-line @typescript-eslint/no-empty-interface
|
|
||||||
export interface Locals {}
|
|
||||||
}
|
|
||||||
|
|
||||||
interface ImportMetaEnv {
|
interface ImportMetaEnv {
|
||||||
/**
|
/**
|
||||||
* The prefix for Astro-generated asset links if the build.assetsPrefix config option is set. This can be used to create asset links not handled by Astro.
|
* The prefix for Astro-generated asset links if the build.assetsPrefix config option is set. This can be used to create asset links not handled by Astro.
|
||||||
|
@ -52,7 +46,7 @@ declare module 'astro:assets' {
|
||||||
getImage: (
|
getImage: (
|
||||||
options: import('./dist/assets/types.js').UnresolvedImageTransform,
|
options: import('./dist/assets/types.js').UnresolvedImageTransform,
|
||||||
) => Promise<import('./dist/assets/types.js').GetImageResult>;
|
) => Promise<import('./dist/assets/types.js').GetImageResult>;
|
||||||
imageConfig: import('./dist/@types/astro.js').AstroConfig['image'];
|
imageConfig: import('./dist/types/public/config.js').AstroConfig['image'];
|
||||||
getConfiguredImageService: typeof import('./dist/assets/index.js').getConfiguredImageService;
|
getConfiguredImageService: typeof import('./dist/assets/index.js').getConfiguredImageService;
|
||||||
inferRemoteSize: typeof import('./dist/assets/utils/index.js').inferRemoteSize;
|
inferRemoteSize: typeof import('./dist/assets/utils/index.js').inferRemoteSize;
|
||||||
Image: typeof import('./components/Image.astro').default;
|
Image: typeof import('./components/Image.astro').default;
|
||||||
|
@ -172,7 +166,7 @@ declare module 'astro:components' {
|
||||||
export * from 'astro/components';
|
export * from 'astro/components';
|
||||||
}
|
}
|
||||||
|
|
||||||
type MD = import('./dist/@types/astro.js').MarkdownInstance<Record<string, any>>;
|
type MD = import('./dist/types/public/content.js').MarkdownInstance<Record<string, any>>;
|
||||||
interface ExportedMarkdownModuleEntities {
|
interface ExportedMarkdownModuleEntities {
|
||||||
frontmatter: MD['frontmatter'];
|
frontmatter: MD['frontmatter'];
|
||||||
file: MD['file'];
|
file: MD['file'];
|
||||||
|
@ -191,7 +185,6 @@ declare module '*.md' {
|
||||||
file,
|
file,
|
||||||
url,
|
url,
|
||||||
getHeadings,
|
getHeadings,
|
||||||
getHeaders,
|
|
||||||
Content,
|
Content,
|
||||||
rawContent,
|
rawContent,
|
||||||
compiledContent,
|
compiledContent,
|
||||||
|
@ -206,7 +199,6 @@ declare module '*.markdown' {
|
||||||
file,
|
file,
|
||||||
url,
|
url,
|
||||||
getHeadings,
|
getHeadings,
|
||||||
getHeaders,
|
|
||||||
Content,
|
Content,
|
||||||
rawContent,
|
rawContent,
|
||||||
compiledContent,
|
compiledContent,
|
||||||
|
@ -221,7 +213,6 @@ declare module '*.mkdn' {
|
||||||
file,
|
file,
|
||||||
url,
|
url,
|
||||||
getHeadings,
|
getHeadings,
|
||||||
getHeaders,
|
|
||||||
Content,
|
Content,
|
||||||
rawContent,
|
rawContent,
|
||||||
compiledContent,
|
compiledContent,
|
||||||
|
@ -236,7 +227,6 @@ declare module '*.mkd' {
|
||||||
file,
|
file,
|
||||||
url,
|
url,
|
||||||
getHeadings,
|
getHeadings,
|
||||||
getHeaders,
|
|
||||||
Content,
|
Content,
|
||||||
rawContent,
|
rawContent,
|
||||||
compiledContent,
|
compiledContent,
|
||||||
|
@ -251,7 +241,6 @@ declare module '*.mdwn' {
|
||||||
file,
|
file,
|
||||||
url,
|
url,
|
||||||
getHeadings,
|
getHeadings,
|
||||||
getHeaders,
|
|
||||||
Content,
|
Content,
|
||||||
rawContent,
|
rawContent,
|
||||||
compiledContent,
|
compiledContent,
|
||||||
|
@ -266,7 +255,6 @@ declare module '*.mdown' {
|
||||||
file,
|
file,
|
||||||
url,
|
url,
|
||||||
getHeadings,
|
getHeadings,
|
||||||
getHeaders,
|
|
||||||
Content,
|
Content,
|
||||||
rawContent,
|
rawContent,
|
||||||
compiledContent,
|
compiledContent,
|
||||||
|
@ -275,7 +263,7 @@ declare module '*.mdown' {
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module '*.mdx' {
|
declare module '*.mdx' {
|
||||||
type MDX = import('./dist/@types/astro.js').MDXInstance<Record<string, any>>;
|
type MDX = import('./dist/types/public/content.js').MDXInstance<Record<string, any>>;
|
||||||
|
|
||||||
export const frontmatter: MDX['frontmatter'];
|
export const frontmatter: MDX['frontmatter'];
|
||||||
export const file: MDX['file'];
|
export const file: MDX['file'];
|
||||||
|
@ -288,7 +276,7 @@ declare module '*.mdx' {
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module 'astro:ssr-manifest' {
|
declare module 'astro:ssr-manifest' {
|
||||||
export const manifest: import('./dist/@types/astro.js').SSRManifest;
|
export const manifest: import('./dist/types/public/internal.js').SSRManifest;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Everything below are Vite's types (apart from image types, which are in `client.d.ts`)
|
// Everything below are Vite's types (apart from image types, which are in `client.d.ts`)
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
---
|
---
|
||||||
import { type LocalImageProps, type RemoteImageProps, getImage } from 'astro:assets';
|
import { type LocalImageProps, type RemoteImageProps, getImage } from 'astro:assets';
|
||||||
import * as mime from 'mrmime';
|
import * as mime from 'mrmime';
|
||||||
import type { GetImageResult, ImageOutputFormat } from '../dist/@types/astro';
|
import type { GetImageResult, ImageOutputFormat } from '../dist/types/public/index.js';
|
||||||
import { isESMImportedImage, resolveSrc } from '../dist/assets/utils/imageKind';
|
import { isESMImportedImage, resolveSrc } from '../dist/assets/utils/imageKind';
|
||||||
import { AstroError, AstroErrorData } from '../dist/core/errors/index.js';
|
import { AstroError, AstroErrorData } from '../dist/core/errors/index.js';
|
||||||
import type { HTMLAttributes } from '../types';
|
import type { HTMLAttributes } from '../types';
|
||||||
|
|
8
packages/astro/config.d.ts
vendored
8
packages/astro/config.d.ts
vendored
|
@ -1,8 +1,8 @@
|
||||||
type ViteUserConfig = import('vite').UserConfig;
|
type ViteUserConfig = import('vite').UserConfig;
|
||||||
type ViteUserConfigFn = import('vite').UserConfigFn;
|
type ViteUserConfigFn = import('vite').UserConfigFn;
|
||||||
type AstroUserConfig = import('./dist/@types/astro.js').AstroUserConfig;
|
type AstroUserConfig = import('./dist/types/public/config.js').AstroUserConfig;
|
||||||
type AstroInlineConfig = import('./dist/@types/astro.js').AstroInlineConfig;
|
type AstroInlineConfig = import('./dist/types/public/config.js').AstroInlineConfig;
|
||||||
type ImageServiceConfig = import('./dist/@types/astro.js').ImageServiceConfig;
|
type ImageServiceConfig = import('./dist/types/public/config.js').ImageServiceConfig;
|
||||||
type SharpImageServiceConfig = import('./dist/assets/services/sharp.js').SharpImageServiceConfig;
|
type SharpImageServiceConfig = import('./dist/assets/services/sharp.js').SharpImageServiceConfig;
|
||||||
type EnvField = typeof import('./dist/env/config.js').envField;
|
type EnvField = typeof import('./dist/env/config.js').envField;
|
||||||
|
|
||||||
|
@ -42,4 +42,4 @@ export function passthroughImageService(): ImageServiceConfig;
|
||||||
/**
|
/**
|
||||||
* Return a valid env field to use in this Astro config for `experimental.env.schema`.
|
* Return a valid env field to use in this Astro config for `experimental.env.schema`.
|
||||||
*/
|
*/
|
||||||
export const envField: EnvField;
|
export declare const envField: EnvField;
|
||||||
|
|
2
packages/astro/env.d.ts
vendored
2
packages/astro/env.d.ts
vendored
|
@ -4,7 +4,7 @@
|
||||||
// As such, if the typings you're trying to add should be available inside ex: React components, they should instead
|
// As such, if the typings you're trying to add should be available inside ex: React components, they should instead
|
||||||
// be inside `client.d.ts`
|
// be inside `client.d.ts`
|
||||||
|
|
||||||
type Astro = import('./dist/@types/astro.js').AstroGlobal;
|
type Astro = import('./dist/types/public/context.js').AstroGlobal;
|
||||||
|
|
||||||
// We have to duplicate the description here because editors won't show the JSDoc comment from the imported type
|
// We have to duplicate the description here because editors won't show the JSDoc comment from the imported type
|
||||||
// However, they will for its properties, ex: Astro.request will show the AstroGlobal.request description
|
// However, they will for its properties, ex: Astro.request will show the AstroGlobal.request description
|
||||||
|
|
2
packages/astro/index.d.ts
vendored
2
packages/astro/index.d.ts
vendored
|
@ -1,2 +1,2 @@
|
||||||
export type * from './dist/@types/astro.js';
|
export type * from './dist/types/public/index.js';
|
||||||
export * from './dist/core/index.js';
|
export * from './dist/core/index.js';
|
||||||
|
|
|
@ -1,5 +0,0 @@
|
||||||
# `@types/`
|
|
||||||
|
|
||||||
TypeScript definitions and types for untyped modules.
|
|
||||||
|
|
||||||
[See CONTRIBUTING.md](../../../../CONTRIBUTING.md) for a code overview.
|
|
9
packages/astro/src/@types/app.d.ts
vendored
9
packages/astro/src/@types/app.d.ts
vendored
|
@ -1,9 +0,0 @@
|
||||||
/**
|
|
||||||
* Shared interfaces throughout the application that can be overridden by the user.
|
|
||||||
*/
|
|
||||||
declare namespace App {
|
|
||||||
/**
|
|
||||||
* Used by middlewares to store information, that can be read by the user via the global `Astro.locals`
|
|
||||||
*/
|
|
||||||
interface Locals {}
|
|
||||||
}
|
|
|
@ -1,9 +1,10 @@
|
||||||
import fsMod from 'node:fs';
|
import fsMod from 'node:fs';
|
||||||
import type { Plugin as VitePlugin } from 'vite';
|
import type { Plugin as VitePlugin } from 'vite';
|
||||||
import type { AstroIntegration, AstroSettings } from '../@types/astro.js';
|
|
||||||
import { ActionsWithoutServerOutputError } from '../core/errors/errors-data.js';
|
import { ActionsWithoutServerOutputError } from '../core/errors/errors-data.js';
|
||||||
import { AstroError } from '../core/errors/errors.js';
|
import { AstroError } from '../core/errors/errors.js';
|
||||||
import { isServerLikeOutput, viteID } from '../core/util.js';
|
import { isServerLikeOutput, viteID } from '../core/util.js';
|
||||||
|
import type { AstroSettings } from '../types/astro.js';
|
||||||
|
import type { AstroIntegration } from '../types/public/integrations.js';
|
||||||
import {
|
import {
|
||||||
ACTIONS_TYPES_FILE,
|
ACTIONS_TYPES_FILE,
|
||||||
NOOP_ACTIONS,
|
NOOP_ACTIONS,
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import { yellow } from 'kleur/colors';
|
import { yellow } from 'kleur/colors';
|
||||||
import type { APIContext, MiddlewareNext } from '../../@types/astro.js';
|
|
||||||
import { ActionQueryStringInvalidError } from '../../core/errors/errors-data.js';
|
import { ActionQueryStringInvalidError } from '../../core/errors/errors-data.js';
|
||||||
import { AstroError } from '../../core/errors/errors.js';
|
import { AstroError } from '../../core/errors/errors.js';
|
||||||
import { defineMiddleware } from '../../core/middleware/index.js';
|
import { defineMiddleware } from '../../core/middleware/index.js';
|
||||||
|
import type { MiddlewareNext } from '../../types/public/common.js';
|
||||||
|
import type { APIContext } from '../../types/public/context.js';
|
||||||
import { ACTION_QUERY_PARAMS } from '../consts.js';
|
import { ACTION_QUERY_PARAMS } from '../consts.js';
|
||||||
import { formContentTypes, hasContentType } from './utils.js';
|
import { formContentTypes, hasContentType } from './utils.js';
|
||||||
import { getAction } from './virtual/get-action.js';
|
import { getAction } from './virtual/get-action.js';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { APIRoute } from '../../@types/astro.js';
|
import type { APIRoute } from '../../types/public/common.js';
|
||||||
import { formContentTypes, hasContentType } from './utils.js';
|
import { formContentTypes, hasContentType } from './utils.js';
|
||||||
import { getAction } from './virtual/get-action.js';
|
import { getAction } from './virtual/get-action.js';
|
||||||
import { serializeActionResult } from './virtual/shared.js';
|
import { serializeActionResult } from './virtual/shared.js';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { APIContext } from '../../@types/astro.js';
|
import type { APIContext } from '../../types/public/context.js';
|
||||||
|
|
||||||
export const formContentTypes = ['application/x-www-form-urlencoded', 'multipart/form-data'];
|
export const formContentTypes = ['application/x-www-form-urlencoded', 'multipart/form-data'];
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import type { APIContext } from '../@types/astro.js';
|
import type { APIContext } from '../types/public/context.js';
|
||||||
import type { Locals } from './runtime/middleware.js';
|
import type { Locals } from './runtime/middleware.js';
|
||||||
import { type ActionAPIContext } from './runtime/utils.js';
|
import type { ActionAPIContext } from './runtime/utils.js';
|
||||||
import { deserializeActionResult, getActionQueryString } from './runtime/virtual/shared.js';
|
import { deserializeActionResult, getActionQueryString } from './runtime/virtual/shared.js';
|
||||||
|
|
||||||
export function hasActionPayload(locals: APIContext['locals']): locals is Locals {
|
export function hasActionPayload(locals: APIContext['locals']): locals is Locals {
|
||||||
|
|
|
@ -2,7 +2,6 @@ import fs, { readFileSync } from 'node:fs';
|
||||||
import { basename } from 'node:path/posix';
|
import { basename } from 'node:path/posix';
|
||||||
import { dim, green } from 'kleur/colors';
|
import { dim, green } from 'kleur/colors';
|
||||||
import type PQueue from 'p-queue';
|
import type PQueue from 'p-queue';
|
||||||
import type { AstroConfig } from '../../@types/astro.js';
|
|
||||||
import { getOutDirWithinCwd } from '../../core/build/common.js';
|
import { getOutDirWithinCwd } from '../../core/build/common.js';
|
||||||
import type { BuildPipeline } from '../../core/build/pipeline.js';
|
import type { BuildPipeline } from '../../core/build/pipeline.js';
|
||||||
import { getTimeStat } from '../../core/build/util.js';
|
import { getTimeStat } from '../../core/build/util.js';
|
||||||
|
@ -12,6 +11,7 @@ import type { Logger } from '../../core/logger/core.js';
|
||||||
import { isRemotePath, removeLeadingForwardSlash } from '../../core/path.js';
|
import { isRemotePath, removeLeadingForwardSlash } from '../../core/path.js';
|
||||||
import { isServerLikeOutput } from '../../core/util.js';
|
import { isServerLikeOutput } from '../../core/util.js';
|
||||||
import type { MapValue } from '../../type-utils.js';
|
import type { MapValue } from '../../type-utils.js';
|
||||||
|
import type { AstroConfig } from '../../types/public/config.js';
|
||||||
import { getConfiguredImageService } from '../internal.js';
|
import { getConfiguredImageService } from '../internal.js';
|
||||||
import type { LocalImageService } from '../services/service.js';
|
import type { LocalImageService } from '../services/service.js';
|
||||||
import type { AssetsGlobalStaticImagesList, ImageMetadata, ImageTransform } from '../types.js';
|
import type { AssetsGlobalStaticImagesList, ImageMetadata, ImageTransform } from '../types.js';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { AstroSettings } from '../../@types/astro.js';
|
import type { AstroSettings } from '../../types/astro.js';
|
||||||
|
|
||||||
export function injectImageEndpoint(settings: AstroSettings, mode: 'dev' | 'build') {
|
export function injectImageEndpoint(settings: AstroSettings, mode: 'dev' | 'build') {
|
||||||
const endpointEntrypoint =
|
const endpointEntrypoint =
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
import { imageConfig } from 'astro:assets';
|
import { imageConfig } from 'astro:assets';
|
||||||
import { isRemotePath } from '@astrojs/internal-helpers/path';
|
import { isRemotePath } from '@astrojs/internal-helpers/path';
|
||||||
import * as mime from 'mrmime';
|
import * as mime from 'mrmime';
|
||||||
import type { APIRoute } from '../../@types/astro.js';
|
import type { APIRoute } from '../../types/public/common.js';
|
||||||
import { getConfiguredImageService } from '../internal.js';
|
import { getConfiguredImageService } from '../internal.js';
|
||||||
import { etag } from '../utils/etag.js';
|
import { etag } from '../utils/etag.js';
|
||||||
import { isRemoteAllowed } from '../utils/remotePattern.js';
|
import { isRemoteAllowed } from '../utils/remotePattern.js';
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||||
import { assetsDir, imageConfig, outDir } from 'astro:assets';
|
import { assetsDir, imageConfig, outDir } from 'astro:assets';
|
||||||
import { isRemotePath, removeQueryString } from '@astrojs/internal-helpers/path';
|
import { isRemotePath, removeQueryString } from '@astrojs/internal-helpers/path';
|
||||||
import * as mime from 'mrmime';
|
import * as mime from 'mrmime';
|
||||||
import type { APIRoute } from '../../@types/astro.js';
|
import type { APIRoute } from '../../types/public/common.js';
|
||||||
import { getConfiguredImageService } from '../internal.js';
|
import { getConfiguredImageService } from '../internal.js';
|
||||||
import { etag } from '../utils/etag.js';
|
import { etag } from '../utils/etag.js';
|
||||||
import { isRemoteAllowed } from '../utils/remotePattern.js';
|
import { isRemoteAllowed } from '../utils/remotePattern.js';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { AstroConfig } from '../@types/astro.js';
|
|
||||||
import { AstroError, AstroErrorData } from '../core/errors/index.js';
|
import { AstroError, AstroErrorData } from '../core/errors/index.js';
|
||||||
|
import type { AstroConfig } from '../types/public/config.js';
|
||||||
import { DEFAULT_HASH_PROPS } from './consts.js';
|
import { DEFAULT_HASH_PROPS } from './consts.js';
|
||||||
import { type ImageService, isLocalService } from './services/service.js';
|
import { type ImageService, isLocalService } from './services/service.js';
|
||||||
import {
|
import {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import type { AstroConfig } from '../../@types/astro.js';
|
|
||||||
import { AstroError, AstroErrorData } from '../../core/errors/index.js';
|
import { AstroError, AstroErrorData } from '../../core/errors/index.js';
|
||||||
import { isRemotePath, joinPaths } from '../../core/path.js';
|
import { isRemotePath, joinPaths } from '../../core/path.js';
|
||||||
|
import type { AstroConfig } from '../../types/public/config.js';
|
||||||
import { DEFAULT_HASH_PROPS, DEFAULT_OUTPUT_FORMAT, VALID_SUPPORTED_FORMATS } from '../consts.js';
|
import { DEFAULT_HASH_PROPS, DEFAULT_OUTPUT_FORMAT, VALID_SUPPORTED_FORMATS } from '../consts.js';
|
||||||
import type { ImageOutputFormat, ImageTransform, UnresolvedSrcSetValue } from '../types.js';
|
import type { ImageOutputFormat, ImageTransform, UnresolvedSrcSetValue } from '../types.js';
|
||||||
import { isESMImportedImage } from '../utils/imageKind.js';
|
import { isESMImportedImage } from '../utils/imageKind.js';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { isRemotePath } from '@astrojs/internal-helpers/path';
|
import { isRemotePath } from '@astrojs/internal-helpers/path';
|
||||||
import type { AstroConfig } from '../../@types/astro.js';
|
import type { AstroConfig } from '../../types/public/config.js';
|
||||||
|
|
||||||
export type RemotePattern = {
|
export type RemotePattern = {
|
||||||
hostname?: string;
|
hostname?: string;
|
||||||
|
|
|
@ -2,7 +2,6 @@ import { extname } from 'node:path';
|
||||||
import MagicString from 'magic-string';
|
import MagicString from 'magic-string';
|
||||||
import type * as vite from 'vite';
|
import type * as vite from 'vite';
|
||||||
import { normalizePath } from 'vite';
|
import { normalizePath } from 'vite';
|
||||||
import type { AstroPluginOptions, AstroSettings, ImageTransform } from '../@types/astro.js';
|
|
||||||
import { extendManualChunks } from '../core/build/plugins/util.js';
|
import { extendManualChunks } from '../core/build/plugins/util.js';
|
||||||
import { AstroError, AstroErrorData } from '../core/errors/index.js';
|
import { AstroError, AstroErrorData } from '../core/errors/index.js';
|
||||||
import {
|
import {
|
||||||
|
@ -13,7 +12,9 @@ import {
|
||||||
removeQueryString,
|
removeQueryString,
|
||||||
} from '../core/path.js';
|
} from '../core/path.js';
|
||||||
import { isServerLikeOutput } from '../core/util.js';
|
import { isServerLikeOutput } from '../core/util.js';
|
||||||
|
import type { AstroPluginOptions, AstroSettings } from '../types/astro.js';
|
||||||
import { VALID_INPUT_FORMATS, VIRTUAL_MODULE_ID, VIRTUAL_SERVICE_ID } from './consts.js';
|
import { VALID_INPUT_FORMATS, VIRTUAL_MODULE_ID, VIRTUAL_SERVICE_ID } from './consts.js';
|
||||||
|
import type { ImageTransform } from './types.js';
|
||||||
import { getAssetsPrefix } from './utils/getAssetsPrefix.js';
|
import { getAssetsPrefix } from './utils/getAssetsPrefix.js';
|
||||||
import { isESMImportedImage } from './utils/imageKind.js';
|
import { isESMImportedImage } from './utils/imageKind.js';
|
||||||
import { emitESMImage } from './utils/node/emitAsset.js';
|
import { emitESMImage } from './utils/node/emitAsset.js';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { Arguments } from 'yargs-parser';
|
import type { Arguments } from 'yargs-parser';
|
||||||
import type { AstroConfig } from '../../@types/astro.js';
|
import type { AstroConfig } from '../../types/public/config.js';
|
||||||
import { resolveConfig } from '../../core/config/config.js';
|
import { resolveConfig } from '../../core/config/config.js';
|
||||||
import { apply as applyPolyfill } from '../../core/polyfill.js';
|
import { apply as applyPolyfill } from '../../core/polyfill.js';
|
||||||
import { createLoggerFromFlags, flagsToAstroInlineConfig } from '../flags.js';
|
import { createLoggerFromFlags, flagsToAstroInlineConfig } from '../flags.js';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import type { Arguments } from 'yargs-parser';
|
import type { Arguments } from 'yargs-parser';
|
||||||
import type { AstroInlineConfig } from '../@types/astro.js';
|
|
||||||
import { type LogOptions, Logger } from '../core/logger/core.js';
|
import { type LogOptions, Logger } from '../core/logger/core.js';
|
||||||
import { nodeLogDestination } from '../core/logger/node.js';
|
import { nodeLogDestination } from '../core/logger/node.js';
|
||||||
|
import type { AstroInlineConfig } from '../types/public/config.js';
|
||||||
|
|
||||||
// Alias for now, but allows easier migration to node's `parseArgs` in the future.
|
// Alias for now, but allows easier migration to node's `parseArgs` in the future.
|
||||||
export type Flags = Arguments;
|
export type Flags = Arguments;
|
||||||
|
|
|
@ -3,10 +3,10 @@ import { arch, platform } from 'node:os';
|
||||||
/* eslint-disable no-console */
|
/* eslint-disable no-console */
|
||||||
import * as colors from 'kleur/colors';
|
import * as colors from 'kleur/colors';
|
||||||
import prompts from 'prompts';
|
import prompts from 'prompts';
|
||||||
import type { AstroConfig, AstroUserConfig } from '../../@types/astro.js';
|
|
||||||
import { resolveConfig } from '../../core/config/index.js';
|
import { resolveConfig } from '../../core/config/index.js';
|
||||||
import { ASTRO_VERSION } from '../../core/constants.js';
|
import { ASTRO_VERSION } from '../../core/constants.js';
|
||||||
import { apply as applyPolyfill } from '../../core/polyfill.js';
|
import { apply as applyPolyfill } from '../../core/polyfill.js';
|
||||||
|
import type { AstroConfig, AstroUserConfig } from '../../types/public/config.js';
|
||||||
import { type Flags, flagsToAstroInlineConfig } from '../flags.js';
|
import { type Flags, flagsToAstroInlineConfig } from '../flags.js';
|
||||||
|
|
||||||
interface InfoOptions {
|
interface InfoOptions {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/* eslint-disable no-console */
|
/* eslint-disable no-console */
|
||||||
import type { AstroSettings } from '../../@types/astro.js';
|
import type { AstroSettings } from '../../types/astro.js';
|
||||||
|
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import { bgGreen, black, bold, dim, yellow } from 'kleur/colors';
|
import { bgGreen, black, bold, dim, yellow } from 'kleur/colors';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import type { UserConfig as ViteUserConfig } from 'vite';
|
import type { UserConfig as ViteUserConfig } from 'vite';
|
||||||
import type { AstroInlineConfig, AstroUserConfig } from '../@types/astro.js';
|
|
||||||
import { Logger } from '../core/logger/core.js';
|
import { Logger } from '../core/logger/core.js';
|
||||||
|
import type { AstroInlineConfig, AstroUserConfig } from '../types/public/config.js';
|
||||||
|
|
||||||
export function defineConfig(config: AstroUserConfig) {
|
export function defineConfig(config: AstroUserConfig) {
|
||||||
return config;
|
return config;
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import type fsMod from 'node:fs';
|
import type fsMod from 'node:fs';
|
||||||
import type { Plugin, ViteDevServer } from 'vite';
|
import type { Plugin, ViteDevServer } from 'vite';
|
||||||
import type { AstroSettings } from '../@types/astro.js';
|
|
||||||
import { attachContentServerListeners } from '../content/server-listeners.js';
|
import { attachContentServerListeners } from '../content/server-listeners.js';
|
||||||
import type { Logger } from '../core/logger/core.js';
|
import type { Logger } from '../core/logger/core.js';
|
||||||
|
import type { AstroSettings } from '../types/astro.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Listen for Astro content directory changes and generate types.
|
* Listen for Astro content directory changes and generate types.
|
||||||
|
|
|
@ -1,19 +1,4 @@
|
||||||
import { posix } from 'node:path';
|
import { posix } from 'node:path';
|
||||||
import type {
|
|
||||||
AstroConfig,
|
|
||||||
AstroUserConfig,
|
|
||||||
ComponentInstance,
|
|
||||||
ContainerImportRendererFn,
|
|
||||||
MiddlewareHandler,
|
|
||||||
NamedSSRLoadedRendererValue,
|
|
||||||
Props,
|
|
||||||
RouteData,
|
|
||||||
RouteType,
|
|
||||||
SSRLoadedRenderer,
|
|
||||||
SSRLoadedRendererValue,
|
|
||||||
SSRManifest,
|
|
||||||
SSRResult,
|
|
||||||
} from '../@types/astro.js';
|
|
||||||
import { getDefaultClientDirectives } from '../core/client-directive/index.js';
|
import { getDefaultClientDirectives } from '../core/client-directive/index.js';
|
||||||
import { ASTRO_CONFIG_DEFAULTS } from '../core/config/schema.js';
|
import { ASTRO_CONFIG_DEFAULTS } from '../core/config/schema.js';
|
||||||
import { validateConfig } from '../core/config/validate.js';
|
import { validateConfig } from '../core/config/validate.js';
|
||||||
|
@ -25,8 +10,32 @@ import { RenderContext } from '../core/render-context.js';
|
||||||
import { getParts, validateSegment } from '../core/routing/manifest/create.js';
|
import { getParts, validateSegment } from '../core/routing/manifest/create.js';
|
||||||
import { getPattern } from '../core/routing/manifest/pattern.js';
|
import { getPattern } from '../core/routing/manifest/pattern.js';
|
||||||
import type { AstroComponentFactory } from '../runtime/server/index.js';
|
import type { AstroComponentFactory } from '../runtime/server/index.js';
|
||||||
|
import type { ComponentInstance } from '../types/astro.js';
|
||||||
|
import type { MiddlewareHandler, Props } from '../types/public/common.js';
|
||||||
|
import type { AstroConfig, AstroUserConfig } from '../types/public/config.js';
|
||||||
|
import type {
|
||||||
|
NamedSSRLoadedRendererValue,
|
||||||
|
RouteData,
|
||||||
|
RouteType,
|
||||||
|
SSRLoadedRenderer,
|
||||||
|
SSRLoadedRendererValue,
|
||||||
|
SSRManifest,
|
||||||
|
SSRResult,
|
||||||
|
} from '../types/public/internal.js';
|
||||||
import { ContainerPipeline } from './pipeline.js';
|
import { ContainerPipeline } from './pipeline.js';
|
||||||
|
|
||||||
|
/** Public type, used for integrations to define a renderer for the container API */
|
||||||
|
export type ContainerRenderer = {
|
||||||
|
/**
|
||||||
|
* The name of the renderer.
|
||||||
|
*/
|
||||||
|
name: string;
|
||||||
|
/**
|
||||||
|
* The entrypoint that is used to render a component on the server
|
||||||
|
*/
|
||||||
|
serverEntrypoint: string;
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Options to be passed when rendering a route
|
* Options to be passed when rendering a route
|
||||||
*/
|
*/
|
||||||
|
@ -103,6 +112,10 @@ export type AddClientRenderer = {
|
||||||
entrypoint: string;
|
entrypoint: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
type ContainerImportRendererFn = (
|
||||||
|
containerRenderer: ContainerRenderer,
|
||||||
|
) => Promise<SSRLoadedRenderer>;
|
||||||
|
|
||||||
function createManifest(
|
function createManifest(
|
||||||
manifest?: AstroContainerManifest,
|
manifest?: AstroContainerManifest,
|
||||||
renderers?: SSRLoadedRenderer[],
|
renderers?: SSRLoadedRenderer[],
|
||||||
|
|
|
@ -1,10 +1,3 @@
|
||||||
import type {
|
|
||||||
ComponentInstance,
|
|
||||||
RewritePayload,
|
|
||||||
RouteData,
|
|
||||||
SSRElement,
|
|
||||||
SSRResult,
|
|
||||||
} from '../@types/astro.js';
|
|
||||||
import { type HeadElements, Pipeline } from '../core/base-pipeline.js';
|
import { type HeadElements, Pipeline } from '../core/base-pipeline.js';
|
||||||
import type { SinglePageBuiltModule } from '../core/build/types.js';
|
import type { SinglePageBuiltModule } from '../core/build/types.js';
|
||||||
import {
|
import {
|
||||||
|
@ -12,6 +5,9 @@ import {
|
||||||
createStylesheetElementSet,
|
createStylesheetElementSet,
|
||||||
} from '../core/render/ssr-element.js';
|
} from '../core/render/ssr-element.js';
|
||||||
import { findRouteToRewrite } from '../core/routing/rewrite.js';
|
import { findRouteToRewrite } from '../core/routing/rewrite.js';
|
||||||
|
import type { ComponentInstance } from '../types/astro.js';
|
||||||
|
import type { RewritePayload } from '../types/public/common.js';
|
||||||
|
import type { RouteData, SSRElement, SSRResult } from '../types/public/internal.js';
|
||||||
|
|
||||||
export class ContainerPipeline extends Pipeline {
|
export class ContainerPipeline extends Pipeline {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -3,9 +3,9 @@ import { isAbsolute } from 'node:path';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import type { FSWatcher } from 'vite';
|
import type { FSWatcher } from 'vite';
|
||||||
import xxhash from 'xxhash-wasm';
|
import xxhash from 'xxhash-wasm';
|
||||||
import type { AstroSettings } from '../@types/astro.js';
|
|
||||||
import { AstroUserError } from '../core/errors/errors.js';
|
import { AstroUserError } from '../core/errors/errors.js';
|
||||||
import type { Logger } from '../core/logger/core.js';
|
import type { Logger } from '../core/logger/core.js';
|
||||||
|
import type { AstroSettings } from '../types/astro.js';
|
||||||
import {
|
import {
|
||||||
ASSET_IMPORTS_FILE,
|
ASSET_IMPORTS_FILE,
|
||||||
CONTENT_LAYER_TYPE,
|
CONTENT_LAYER_TYPE,
|
||||||
|
|
|
@ -4,7 +4,7 @@ import fastGlob from 'fast-glob';
|
||||||
import { bold, green } from 'kleur/colors';
|
import { bold, green } from 'kleur/colors';
|
||||||
import micromatch from 'micromatch';
|
import micromatch from 'micromatch';
|
||||||
import pLimit from 'p-limit';
|
import pLimit from 'p-limit';
|
||||||
import type { ContentEntryRenderFuction, ContentEntryType } from '../../@types/astro.js';
|
import type { ContentEntryRenderFunction, ContentEntryType } from '../../types/public/content.js';
|
||||||
import type { RenderedContent } from '../data-store.js';
|
import type { RenderedContent } from '../data-store.js';
|
||||||
import { getContentEntryIdAndSlug, getEntryConfigByExtMap, posixRelative } from '../utils.js';
|
import { getContentEntryIdAndSlug, getEntryConfigByExtMap, posixRelative } from '../utils.js';
|
||||||
import type { Loader } from './types.js';
|
import type { Loader } from './types.js';
|
||||||
|
@ -69,7 +69,7 @@ export function glob(globOptions: GlobOptions): Loader {
|
||||||
load: async ({ settings, logger, watcher, parseData, store, generateDigest }) => {
|
load: async ({ settings, logger, watcher, parseData, store, generateDigest }) => {
|
||||||
const renderFunctionByContentType = new WeakMap<
|
const renderFunctionByContentType = new WeakMap<
|
||||||
ContentEntryType,
|
ContentEntryType,
|
||||||
ContentEntryRenderFuction
|
ContentEntryRenderFunction
|
||||||
>();
|
>();
|
||||||
|
|
||||||
const untouchedEntries = new Set(store.keys());
|
const untouchedEntries = new Set(store.keys());
|
||||||
|
@ -131,7 +131,7 @@ export function glob(globOptions: GlobOptions): Loader {
|
||||||
if (entryType.getRenderFunction) {
|
if (entryType.getRenderFunction) {
|
||||||
let render = renderFunctionByContentType.get(entryType);
|
let render = renderFunctionByContentType.get(entryType);
|
||||||
if (!render) {
|
if (!render) {
|
||||||
render = await entryType.getRenderFunction(settings);
|
render = await entryType.getRenderFunction(settings.config);
|
||||||
// Cache the render function for this content type, so it can re-use parsers and other expensive setup
|
// Cache the render function for this content type, so it can re-use parsers and other expensive setup
|
||||||
renderFunctionByContentType.set(entryType, render);
|
renderFunctionByContentType.set(entryType, render);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
import type { FSWatcher } from 'vite';
|
import type { FSWatcher } from 'vite';
|
||||||
import type { ZodSchema } from 'zod';
|
import type { ZodSchema } from 'zod';
|
||||||
import type { AstroIntegrationLogger, AstroSettings } from '../../@types/astro.js';
|
import type { AstroIntegrationLogger } from '../../core/logger/core.js';
|
||||||
|
import type { AstroSettings } from '../../types/astro.js';
|
||||||
import type { MetaStore, ScopedDataStore } from '../mutable-data-store.js';
|
import type { MetaStore, ScopedDataStore } from '../mutable-data-store.js';
|
||||||
|
|
||||||
export interface ParseDataOptions<TData extends Record<string, unknown>> {
|
export interface ParseDataOptions<TData extends Record<string, unknown>> {
|
||||||
|
|
|
@ -2,7 +2,7 @@ import type { MarkdownHeading } from '@astrojs/markdown-remark';
|
||||||
import { Traverse } from 'neotraverse/modern';
|
import { Traverse } from 'neotraverse/modern';
|
||||||
import pLimit from 'p-limit';
|
import pLimit from 'p-limit';
|
||||||
import { ZodIssueCode, z } from 'zod';
|
import { ZodIssueCode, z } from 'zod';
|
||||||
import type { GetImageResult, ImageMetadata } from '../@types/astro.js';
|
import type { GetImageResult, ImageMetadata } from '../assets/types.js';
|
||||||
import { imageSrcToImportId } from '../assets/utils/resolveImports.js';
|
import { imageSrcToImportId } from '../assets/utils/resolveImports.js';
|
||||||
import { AstroError, AstroErrorData, AstroUserError } from '../core/errors/index.js';
|
import { AstroError, AstroErrorData, AstroUserError } from '../core/errors/index.js';
|
||||||
import { prependForwardSlash } from '../core/path.js';
|
import { prependForwardSlash } from '../core/path.js';
|
||||||
|
|
|
@ -3,10 +3,10 @@ import path from 'node:path';
|
||||||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||||
import { bold, cyan, underline } from 'kleur/colors';
|
import { bold, cyan, underline } from 'kleur/colors';
|
||||||
import type { ViteDevServer } from 'vite';
|
import type { ViteDevServer } from 'vite';
|
||||||
import type { AstroSettings } from '../@types/astro.js';
|
|
||||||
import { loadTSConfig } from '../core/config/tsconfig.js';
|
import { loadTSConfig } from '../core/config/tsconfig.js';
|
||||||
import type { Logger } from '../core/logger/core.js';
|
import type { Logger } from '../core/logger/core.js';
|
||||||
import { appendForwardSlash } from '../core/path.js';
|
import { appendForwardSlash } from '../core/path.js';
|
||||||
|
import type { AstroSettings } from '../types/astro.js';
|
||||||
import { createContentTypesGenerator } from './types-generator.js';
|
import { createContentTypesGenerator } from './types-generator.js';
|
||||||
import { type ContentPaths, getContentPaths, globalContentConfigObserver } from './utils.js';
|
import { type ContentPaths, getContentPaths, globalContentConfigObserver } from './utils.js';
|
||||||
|
|
||||||
|
|
|
@ -7,11 +7,12 @@ import { type ViteDevServer, normalizePath } from 'vite';
|
||||||
import { type ZodSchema, z } from 'zod';
|
import { type ZodSchema, z } from 'zod';
|
||||||
import { zodToJsonSchema } from 'zod-to-json-schema';
|
import { zodToJsonSchema } from 'zod-to-json-schema';
|
||||||
import { printNode, zodToTs } from 'zod-to-ts';
|
import { printNode, zodToTs } from 'zod-to-ts';
|
||||||
import type { AstroSettings, ContentEntryType } from '../@types/astro.js';
|
|
||||||
import { AstroError } from '../core/errors/errors.js';
|
import { AstroError } from '../core/errors/errors.js';
|
||||||
import { AstroErrorData } from '../core/errors/index.js';
|
import { AstroErrorData } from '../core/errors/index.js';
|
||||||
import type { Logger } from '../core/logger/core.js';
|
import type { Logger } from '../core/logger/core.js';
|
||||||
import { isRelativePath } from '../core/path.js';
|
import { isRelativePath } from '../core/path.js';
|
||||||
|
import type { AstroSettings } from '../types/astro.js';
|
||||||
|
import type { ContentEntryType } from '../types/public/content.js';
|
||||||
import { CONTENT_LAYER_TYPE, CONTENT_TYPES_FILE, VIRTUAL_MODULE_ID } from './consts.js';
|
import { CONTENT_LAYER_TYPE, CONTENT_TYPES_FILE, VIRTUAL_MODULE_ID } from './consts.js';
|
||||||
import {
|
import {
|
||||||
type CollectionConfig,
|
type CollectionConfig,
|
||||||
|
|
|
@ -7,15 +7,12 @@ import type { PluginContext } from 'rollup';
|
||||||
import { type ViteDevServer, normalizePath } from 'vite';
|
import { type ViteDevServer, normalizePath } from 'vite';
|
||||||
import xxhash from 'xxhash-wasm';
|
import xxhash from 'xxhash-wasm';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import type {
|
|
||||||
AstroConfig,
|
|
||||||
AstroSettings,
|
|
||||||
ContentEntryType,
|
|
||||||
DataEntryType,
|
|
||||||
} from '../@types/astro.js';
|
|
||||||
import { AstroError, AstroErrorData, MarkdownError, errorMap } from '../core/errors/index.js';
|
import { AstroError, AstroErrorData, MarkdownError, errorMap } from '../core/errors/index.js';
|
||||||
import { isYAMLException } from '../core/errors/utils.js';
|
import { isYAMLException } from '../core/errors/utils.js';
|
||||||
import type { Logger } from '../core/logger/core.js';
|
import type { Logger } from '../core/logger/core.js';
|
||||||
|
import type { AstroSettings } from '../types/astro.js';
|
||||||
|
import type { AstroConfig } from '../types/public/config.js';
|
||||||
|
import type { ContentEntryType, DataEntryType } from '../types/public/content.js';
|
||||||
import {
|
import {
|
||||||
CONTENT_FLAGS,
|
CONTENT_FLAGS,
|
||||||
CONTENT_LAYER_TYPE,
|
CONTENT_LAYER_TYPE,
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
import { extname } from 'node:path';
|
import { extname } from 'node:path';
|
||||||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||||
import type { Plugin } from 'vite';
|
import type { Plugin } from 'vite';
|
||||||
import type { AstroSettings, SSRElement } from '../@types/astro.js';
|
|
||||||
import { getAssetsPrefix } from '../assets/utils/getAssetsPrefix.js';
|
import { getAssetsPrefix } from '../assets/utils/getAssetsPrefix.js';
|
||||||
import type { BuildInternals } from '../core/build/internal.js';
|
import type { BuildInternals } from '../core/build/internal.js';
|
||||||
import type { AstroBuildPlugin } from '../core/build/plugin.js';
|
import type { AstroBuildPlugin } from '../core/build/plugin.js';
|
||||||
|
@ -9,6 +8,8 @@ import type { StaticBuildOptions } from '../core/build/types.js';
|
||||||
import type { ModuleLoader } from '../core/module-loader/loader.js';
|
import type { ModuleLoader } from '../core/module-loader/loader.js';
|
||||||
import { createViteLoader } from '../core/module-loader/vite.js';
|
import { createViteLoader } from '../core/module-loader/vite.js';
|
||||||
import { joinPaths, prependForwardSlash } from '../core/path.js';
|
import { joinPaths, prependForwardSlash } from '../core/path.js';
|
||||||
|
import type { AstroSettings } from '../types/astro.js';
|
||||||
|
import type { SSRElement } from '../types/public/internal.js';
|
||||||
import { getStylesForURL } from '../vite-plugin-astro-server/css.js';
|
import { getStylesForURL } from '../vite-plugin-astro-server/css.js';
|
||||||
import { getScriptsForURL } from '../vite-plugin-astro-server/scripts.js';
|
import { getScriptsForURL } from '../vite-plugin-astro-server/scripts.js';
|
||||||
import {
|
import {
|
||||||
|
|
|
@ -4,19 +4,19 @@ import { pathToFileURL } from 'node:url';
|
||||||
import * as devalue from 'devalue';
|
import * as devalue from 'devalue';
|
||||||
import type { PluginContext } from 'rollup';
|
import type { PluginContext } from 'rollup';
|
||||||
import type { Plugin } from 'vite';
|
import type { Plugin } from 'vite';
|
||||||
import type {
|
|
||||||
AstroConfig,
|
|
||||||
AstroSettings,
|
|
||||||
ContentEntryModule,
|
|
||||||
ContentEntryType,
|
|
||||||
DataEntryModule,
|
|
||||||
DataEntryType,
|
|
||||||
} from '../@types/astro.js';
|
|
||||||
import { getProxyCode } from '../assets/utils/proxy.js';
|
import { getProxyCode } from '../assets/utils/proxy.js';
|
||||||
import { AstroError } from '../core/errors/errors.js';
|
import { AstroError } from '../core/errors/errors.js';
|
||||||
import { AstroErrorData } from '../core/errors/index.js';
|
import { AstroErrorData } from '../core/errors/index.js';
|
||||||
import type { Logger } from '../core/logger/core.js';
|
import type { Logger } from '../core/logger/core.js';
|
||||||
import { isServerLikeOutput } from '../core/util.js';
|
import { isServerLikeOutput } from '../core/util.js';
|
||||||
|
import type { AstroSettings } from '../types/astro.js';
|
||||||
|
import type { AstroConfig } from '../types/public/config.js';
|
||||||
|
import type {
|
||||||
|
ContentEntryModule,
|
||||||
|
ContentEntryType,
|
||||||
|
DataEntryModule,
|
||||||
|
DataEntryType,
|
||||||
|
} from '../types/public/content.js';
|
||||||
import { CONTENT_FLAG, DATA_FLAG } from './consts.js';
|
import { CONTENT_FLAG, DATA_FLAG } from './consts.js';
|
||||||
import {
|
import {
|
||||||
type ContentConfig,
|
type ContentConfig,
|
||||||
|
|
|
@ -5,12 +5,12 @@ import { dataToEsm } from '@rollup/pluginutils';
|
||||||
import glob from 'fast-glob';
|
import glob from 'fast-glob';
|
||||||
import pLimit from 'p-limit';
|
import pLimit from 'p-limit';
|
||||||
import type { Plugin } from 'vite';
|
import type { Plugin } from 'vite';
|
||||||
import type { AstroSettings } from '../@types/astro.js';
|
|
||||||
import { encodeName } from '../core/build/util.js';
|
import { encodeName } from '../core/build/util.js';
|
||||||
import { AstroError, AstroErrorData } from '../core/errors/index.js';
|
import { AstroError, AstroErrorData } from '../core/errors/index.js';
|
||||||
import { appendForwardSlash, removeFileExtension } from '../core/path.js';
|
import { appendForwardSlash, removeFileExtension } from '../core/path.js';
|
||||||
import { isServerLikeOutput } from '../core/util.js';
|
import { isServerLikeOutput } from '../core/util.js';
|
||||||
import { rootRelativePath } from '../core/viteUtils.js';
|
import { rootRelativePath } from '../core/viteUtils.js';
|
||||||
|
import type { AstroSettings } from '../types/astro.js';
|
||||||
import type { AstroPluginMetadata } from '../vite-plugin-astro/index.js';
|
import type { AstroPluginMetadata } from '../vite-plugin-astro/index.js';
|
||||||
import { createDefaultAstroMetadata } from '../vite-plugin-astro/metadata.js';
|
import { createDefaultAstroMetadata } from '../vite-plugin-astro/metadata.js';
|
||||||
import {
|
import {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import type { ManifestData, RouteData, SSRManifest } from '../../@types/astro.js';
|
|
||||||
import { normalizeTheLocale } from '../../i18n/index.js';
|
import { normalizeTheLocale } from '../../i18n/index.js';
|
||||||
|
import type { ManifestData } from '../../types/astro.js';
|
||||||
|
import type { RouteData, SSRManifest } from '../../types/public/internal.js';
|
||||||
import {
|
import {
|
||||||
REROUTABLE_STATUS_CODES,
|
REROUTABLE_STATUS_CODES,
|
||||||
REROUTE_DIRECTIVE_HEADER,
|
REROUTE_DIRECTIVE_HEADER,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { MiddlewareHandler } from '../../@types/astro.js';
|
import type { MiddlewareHandler } from '../../types/public/common.js';
|
||||||
import { defineMiddleware } from '../middleware/index.js';
|
import { defineMiddleware } from '../middleware/index.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import type { IncomingMessage, ServerResponse } from 'node:http';
|
import type { IncomingMessage, ServerResponse } from 'node:http';
|
||||||
import type { RouteData } from '../../@types/astro.js';
|
import type { RouteData } from '../../types/public/internal.js';
|
||||||
import { deserializeManifest } from './common.js';
|
import { deserializeManifest } from './common.js';
|
||||||
import { createOutgoingHttpHeaders } from './createOutgoingHttpHeaders.js';
|
import { createOutgoingHttpHeaders } from './createOutgoingHttpHeaders.js';
|
||||||
import { App } from './index.js';
|
import { App } from './index.js';
|
||||||
|
|
|
@ -1,11 +1,6 @@
|
||||||
import type {
|
import type { ComponentInstance, ManifestData } from '../../types/astro.js';
|
||||||
ComponentInstance,
|
import type { RewritePayload } from '../../types/public/common.js';
|
||||||
ManifestData,
|
import type { RouteData, SSRElement, SSRResult } from '../../types/public/internal.js';
|
||||||
RewritePayload,
|
|
||||||
RouteData,
|
|
||||||
SSRElement,
|
|
||||||
SSRResult,
|
|
||||||
} from '../../@types/astro.js';
|
|
||||||
import { Pipeline } from '../base-pipeline.js';
|
import { Pipeline } from '../base-pipeline.js';
|
||||||
import type { SinglePageBuiltModule } from '../build/types.js';
|
import type { SinglePageBuiltModule } from '../build/types.js';
|
||||||
import { RedirectSinglePageBuiltModule } from '../redirects/component.js';
|
import { RedirectSinglePageBuiltModule } from '../redirects/component.js';
|
||||||
|
|
|
@ -1,14 +1,13 @@
|
||||||
|
import type { RoutingStrategies } from '../../i18n/utils.js';
|
||||||
|
import type { ComponentInstance, SerializedRouteData } from '../../types/astro.js';
|
||||||
|
import type { MiddlewareHandler } from '../../types/public/common.js';
|
||||||
|
import type { Locales } from '../../types/public/config.js';
|
||||||
import type {
|
import type {
|
||||||
ComponentInstance,
|
|
||||||
Locales,
|
|
||||||
MiddlewareHandler,
|
|
||||||
RouteData,
|
RouteData,
|
||||||
SSRComponentMetadata,
|
SSRComponentMetadata,
|
||||||
SSRLoadedRenderer,
|
SSRLoadedRenderer,
|
||||||
SSRResult,
|
SSRResult,
|
||||||
SerializedRouteData,
|
} from '../../types/public/internal.js';
|
||||||
} from '../../@types/astro.js';
|
|
||||||
import type { RoutingStrategies } from '../../i18n/utils.js';
|
|
||||||
import type { SinglePageBuiltModule } from '../build/types.js';
|
import type { SinglePageBuiltModule } from '../build/types.js';
|
||||||
|
|
||||||
export type ComponentPath = string;
|
export type ComponentPath = string;
|
||||||
|
@ -82,6 +81,7 @@ export type SSRManifestI18n = {
|
||||||
domainLookupTable: Record<string, string>;
|
domainLookupTable: Record<string, string>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/** Public type exposed through the `astro:build:ssr` integration hook */
|
||||||
export type SerializedSSRManifest = Omit<
|
export type SerializedSSRManifest = Omit<
|
||||||
SSRManifest,
|
SSRManifest,
|
||||||
| 'middleware'
|
| 'middleware'
|
||||||
|
|
|
@ -1,15 +1,14 @@
|
||||||
|
import { setGetEnv } from '../env/runtime.js';
|
||||||
|
import { createI18nMiddleware } from '../i18n/middleware.js';
|
||||||
|
import type { ComponentInstance } from '../types/astro.js';
|
||||||
|
import type { MiddlewareHandler, RewritePayload } from '../types/public/common.js';
|
||||||
|
import type { RuntimeMode } from '../types/public/config.js';
|
||||||
import type {
|
import type {
|
||||||
ComponentInstance,
|
|
||||||
MiddlewareHandler,
|
|
||||||
RewritePayload,
|
|
||||||
RouteData,
|
RouteData,
|
||||||
RuntimeMode,
|
|
||||||
SSRLoadedRenderer,
|
SSRLoadedRenderer,
|
||||||
SSRManifest,
|
SSRManifest,
|
||||||
SSRResult,
|
SSRResult,
|
||||||
} from '../@types/astro.js';
|
} from '../types/public/internal.js';
|
||||||
import { setGetEnv } from '../env/runtime.js';
|
|
||||||
import { createI18nMiddleware } from '../i18n/middleware.js';
|
|
||||||
import { AstroError } from './errors/errors.js';
|
import { AstroError } from './errors/errors.js';
|
||||||
import { AstroErrorData } from './errors/index.js';
|
import { AstroErrorData } from './errors/index.js';
|
||||||
import type { Logger } from './logger/core.js';
|
import type { Logger } from './logger/core.js';
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
import npath from 'node:path';
|
import npath from 'node:path';
|
||||||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||||
import type { AstroConfig, RouteData } from '../../@types/astro.js';
|
|
||||||
import { appendForwardSlash } from '../../core/path.js';
|
import { appendForwardSlash } from '../../core/path.js';
|
||||||
|
import type { AstroConfig } from '../../types/public/config.js';
|
||||||
|
import type { RouteData } from '../../types/public/internal.js';
|
||||||
|
|
||||||
const STATUS_CODE_PAGES = new Set(['/404', '/500']);
|
const STATUS_CODE_PAGES = new Set(['/404', '/500']);
|
||||||
const FALLBACK_OUT_DIR_NAME = './.astro/';
|
const FALLBACK_OUT_DIR_NAME = './.astro/';
|
||||||
|
|
|
@ -4,7 +4,7 @@ import crypto from 'node:crypto';
|
||||||
import npath from 'node:path';
|
import npath from 'node:path';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import { normalizePath } from 'vite';
|
import { normalizePath } from 'vite';
|
||||||
import type { AstroSettings } from '../../@types/astro.js';
|
import type { AstroSettings } from '../../types/astro.js';
|
||||||
import { viteID } from '../util.js';
|
import { viteID } from '../util.js';
|
||||||
import { getTopLevelPageModuleInfos } from './graph.js';
|
import { getTopLevelPageModuleInfos } from './graph.js';
|
||||||
|
|
||||||
|
|
|
@ -2,18 +2,6 @@ import fs from 'node:fs';
|
||||||
import os from 'node:os';
|
import os from 'node:os';
|
||||||
import { bgGreen, black, blue, bold, dim, green, magenta, red } from 'kleur/colors';
|
import { bgGreen, black, blue, bold, dim, green, magenta, red } from 'kleur/colors';
|
||||||
import PQueue from 'p-queue';
|
import PQueue from 'p-queue';
|
||||||
import type {
|
|
||||||
AstroConfig,
|
|
||||||
AstroSettings,
|
|
||||||
ComponentInstance,
|
|
||||||
GetStaticPathsItem,
|
|
||||||
MiddlewareHandler,
|
|
||||||
RouteData,
|
|
||||||
RouteType,
|
|
||||||
SSRError,
|
|
||||||
SSRLoadedRenderer,
|
|
||||||
SSRManifest,
|
|
||||||
} from '../../@types/astro.js';
|
|
||||||
import {
|
import {
|
||||||
generateImagesForPath,
|
generateImagesForPath,
|
||||||
getStaticImageList,
|
getStaticImageList,
|
||||||
|
@ -29,7 +17,16 @@ import {
|
||||||
import { toRoutingStrategy } from '../../i18n/utils.js';
|
import { toRoutingStrategy } from '../../i18n/utils.js';
|
||||||
import { runHookBuildGenerated } from '../../integrations/hooks.js';
|
import { runHookBuildGenerated } from '../../integrations/hooks.js';
|
||||||
import { getOutputDirectory } from '../../prerender/utils.js';
|
import { getOutputDirectory } from '../../prerender/utils.js';
|
||||||
import type { SSRManifestI18n } from '../app/types.js';
|
import type { AstroSettings, ComponentInstance } from '../../types/astro.js';
|
||||||
|
import type { GetStaticPathsItem, MiddlewareHandler } from '../../types/public/common.js';
|
||||||
|
import type { AstroConfig } from '../../types/public/config.js';
|
||||||
|
import type {
|
||||||
|
RouteData,
|
||||||
|
RouteType,
|
||||||
|
SSRError,
|
||||||
|
SSRLoadedRenderer,
|
||||||
|
} from '../../types/public/internal.js';
|
||||||
|
import type { SSRManifest, SSRManifestI18n } from '../app/types.js';
|
||||||
import { NoPrerenderedRoutesWithDomains } from '../errors/errors-data.js';
|
import { NoPrerenderedRoutesWithDomains } from '../errors/errors-data.js';
|
||||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||||
import { getRedirectLocationOrThrow, routeIsRedirect } from '../redirects/index.js';
|
import { getRedirectLocationOrThrow, routeIsRedirect } from '../redirects/index.js';
|
||||||
|
|
|
@ -3,13 +3,6 @@ import { performance } from 'node:perf_hooks';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import { blue, bold, green } from 'kleur/colors';
|
import { blue, bold, green } from 'kleur/colors';
|
||||||
import type * as vite from 'vite';
|
import type * as vite from 'vite';
|
||||||
import type {
|
|
||||||
AstroConfig,
|
|
||||||
AstroInlineConfig,
|
|
||||||
AstroSettings,
|
|
||||||
ManifestData,
|
|
||||||
RuntimeMode,
|
|
||||||
} from '../../@types/astro.js';
|
|
||||||
import { injectImageEndpoint } from '../../assets/endpoint/config.js';
|
import { injectImageEndpoint } from '../../assets/endpoint/config.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';
|
||||||
|
@ -19,6 +12,8 @@ import {
|
||||||
runHookConfigDone,
|
runHookConfigDone,
|
||||||
runHookConfigSetup,
|
runHookConfigSetup,
|
||||||
} from '../../integrations/hooks.js';
|
} from '../../integrations/hooks.js';
|
||||||
|
import type { AstroSettings, ManifestData } from '../../types/astro.js';
|
||||||
|
import type { AstroConfig, AstroInlineConfig, RuntimeMode } from '../../types/public/config.js';
|
||||||
import { resolveConfig } from '../config/config.js';
|
import { resolveConfig } from '../config/config.js';
|
||||||
import { createNodeLogger } from '../config/logging.js';
|
import { createNodeLogger } from '../config/logging.js';
|
||||||
import { createSettings } from '../config/settings.js';
|
import { createSettings } from '../config/settings.js';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { Rollup } from 'vite';
|
import type { Rollup } from 'vite';
|
||||||
import type { RouteData, SSRResult } from '../../@types/astro.js';
|
import type { RouteData, SSRResult } from '../../types/public/internal.js';
|
||||||
import { prependForwardSlash, removeFileExtension } from '../path.js';
|
import { prependForwardSlash, removeFileExtension } from '../path.js';
|
||||||
import { viteID } from '../util.js';
|
import { viteID } from '../util.js';
|
||||||
import { makePageDataKey } from './plugins/util.js';
|
import { makePageDataKey } from './plugins/util.js';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { AstroSettings, ManifestData } from '../../@types/astro.js';
|
import type { AstroSettings, ManifestData } from '../../types/astro.js';
|
||||||
import type { Logger } from '../logger/core.js';
|
import type { Logger } from '../logger/core.js';
|
||||||
import type { AllPagesData } from './types.js';
|
import type { AllPagesData } from './types.js';
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,7 @@
|
||||||
import type {
|
|
||||||
ComponentInstance,
|
|
||||||
RewritePayload,
|
|
||||||
RouteData,
|
|
||||||
SSRLoadedRenderer,
|
|
||||||
SSRResult,
|
|
||||||
} from '../../@types/astro.js';
|
|
||||||
import { getOutputDirectory } from '../../prerender/utils.js';
|
import { getOutputDirectory } from '../../prerender/utils.js';
|
||||||
|
import type { ComponentInstance } from '../../types/astro.js';
|
||||||
|
import type { RewritePayload } from '../../types/public/common.js';
|
||||||
|
import type { RouteData, SSRLoadedRenderer, SSRResult } from '../../types/public/internal.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 { SSRManifest } from '../app/types.js';
|
import type { SSRManifest } from '../app/types.js';
|
||||||
import { routeIsFallback, routeIsRedirect } from '../redirects/helpers.js';
|
import { routeIsFallback, routeIsRedirect } from '../redirects/helpers.js';
|
||||||
|
|
|
@ -4,13 +4,13 @@ import { fileURLToPath } from 'node:url';
|
||||||
import glob from 'fast-glob';
|
import glob from 'fast-glob';
|
||||||
import pLimit from 'p-limit';
|
import pLimit from 'p-limit';
|
||||||
import { type Plugin as VitePlugin, normalizePath } from 'vite';
|
import { type Plugin as VitePlugin, normalizePath } from 'vite';
|
||||||
import type { AstroConfig } from '../../../@types/astro.js';
|
|
||||||
import { CONTENT_RENDER_FLAG, PROPAGATED_ASSET_FLAG } from '../../../content/consts.js';
|
import { CONTENT_RENDER_FLAG, PROPAGATED_ASSET_FLAG } from '../../../content/consts.js';
|
||||||
import { type ContentLookupMap, hasContentFlag } from '../../../content/utils.js';
|
import { type ContentLookupMap, hasContentFlag } from '../../../content/utils.js';
|
||||||
import {
|
import {
|
||||||
generateContentEntryFile,
|
generateContentEntryFile,
|
||||||
generateLookupMap,
|
generateLookupMap,
|
||||||
} from '../../../content/vite-plugin-content-virtual-mod.js';
|
} from '../../../content/vite-plugin-content-virtual-mod.js';
|
||||||
|
import type { AstroConfig } from '../../../types/public/config.js';
|
||||||
import { configPaths } from '../../config/index.js';
|
import { configPaths } from '../../config/index.js';
|
||||||
import { emptyDir } from '../../fs/index.js';
|
import { emptyDir } from '../../fs/index.js';
|
||||||
import {
|
import {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { BuildOptions, Rollup, Plugin as VitePlugin } from 'vite';
|
import type { BuildOptions, Rollup, Plugin as VitePlugin } from 'vite';
|
||||||
import type { AstroSettings } from '../../../@types/astro.js';
|
import type { AstroSettings } from '../../../types/astro.js';
|
||||||
import { viteID } from '../../util.js';
|
import { viteID } from '../../util.js';
|
||||||
import type { BuildInternals } from '../internal.js';
|
import type { BuildInternals } from '../internal.js';
|
||||||
import { getPageDataByViteID } from '../internal.js';
|
import { getPageDataByViteID } from '../internal.js';
|
||||||
|
|
|
@ -1,8 +1,9 @@
|
||||||
import { join } from 'node:path';
|
import { join } from 'node:path';
|
||||||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||||
import type { Plugin as VitePlugin } from 'vite';
|
import type { Plugin as VitePlugin } from 'vite';
|
||||||
import type { AstroAdapter, AstroSettings } from '../../../@types/astro.js';
|
|
||||||
import { isFunctionPerRouteEnabled } from '../../../integrations/hooks.js';
|
import { isFunctionPerRouteEnabled } from '../../../integrations/hooks.js';
|
||||||
|
import type { AstroSettings } from '../../../types/astro.js';
|
||||||
|
import type { AstroAdapter } from '../../../types/public/integrations.js';
|
||||||
import { routeIsRedirect } from '../../redirects/index.js';
|
import { routeIsRedirect } from '../../redirects/index.js';
|
||||||
import { VIRTUAL_ISLAND_MAP_ID } from '../../server-islands/vite-plugin-server-islands.js';
|
import { VIRTUAL_ISLAND_MAP_ID } from '../../server-islands/vite-plugin-server-islands.js';
|
||||||
import { isServerLikeOutput } from '../../util.js';
|
import { isServerLikeOutput } from '../../util.js';
|
||||||
|
|
|
@ -5,7 +5,6 @@ import { teardown } from '@astrojs/compiler';
|
||||||
import glob from 'fast-glob';
|
import glob from 'fast-glob';
|
||||||
import { bgGreen, bgMagenta, black, green } from 'kleur/colors';
|
import { bgGreen, bgMagenta, black, green } from 'kleur/colors';
|
||||||
import * as vite from 'vite';
|
import * as vite from 'vite';
|
||||||
import type { RouteData } from '../../@types/astro.js';
|
|
||||||
import { PROPAGATED_ASSET_FLAG } from '../../content/consts.js';
|
import { PROPAGATED_ASSET_FLAG } from '../../content/consts.js';
|
||||||
import {
|
import {
|
||||||
getSymlinkedContentCollections,
|
getSymlinkedContentCollections,
|
||||||
|
@ -22,6 +21,7 @@ import { appendForwardSlash, prependForwardSlash, removeFileExtension } from '..
|
||||||
import { isModeServerWithNoAdapter, isServerLikeOutput } from '../../core/util.js';
|
import { isModeServerWithNoAdapter, isServerLikeOutput } from '../../core/util.js';
|
||||||
import { runHookBuildSetup } from '../../integrations/hooks.js';
|
import { runHookBuildSetup } from '../../integrations/hooks.js';
|
||||||
import { getOutputDirectory } from '../../prerender/utils.js';
|
import { getOutputDirectory } from '../../prerender/utils.js';
|
||||||
|
import type { RouteData } from '../../types/public/internal.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 type { Logger } from '../logger/core.js';
|
import type { Logger } from '../logger/core.js';
|
||||||
|
|
|
@ -1,14 +1,9 @@
|
||||||
import type * as vite from 'vite';
|
import type * as vite from 'vite';
|
||||||
import type { InlineConfig } from 'vite';
|
import type { InlineConfig } from 'vite';
|
||||||
import type {
|
import type { AstroSettings, ComponentInstance, ManifestData } from '../../types/astro.js';
|
||||||
AstroSettings,
|
import type { MiddlewareHandler } from '../../types/public/common.js';
|
||||||
ComponentInstance,
|
import type { RuntimeMode } from '../../types/public/config.js';
|
||||||
ManifestData,
|
import type { RouteData, SSRLoadedRenderer } from '../../types/public/internal.js';
|
||||||
MiddlewareHandler,
|
|
||||||
RouteData,
|
|
||||||
RuntimeMode,
|
|
||||||
SSRLoadedRenderer,
|
|
||||||
} from '../../@types/astro.js';
|
|
||||||
import type { Logger } from '../logger/core.js';
|
import type { Logger } from '../logger/core.js';
|
||||||
|
|
||||||
export type ComponentPath = string;
|
export type ComponentPath = string;
|
||||||
|
@ -20,6 +15,7 @@ export type StylesheetAsset =
|
||||||
|
|
||||||
export type HoistedScriptAsset = { type: 'inline' | 'external'; value: string };
|
export type HoistedScriptAsset = { type: 'inline' | 'external'; value: string };
|
||||||
|
|
||||||
|
/** Public type exposed through the `astro:build:setup` integration hook */
|
||||||
export interface PageBuildData {
|
export interface PageBuildData {
|
||||||
key: string;
|
key: string;
|
||||||
component: ComponentPath;
|
component: ComponentPath;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { Rollup } from 'vite';
|
import type { Rollup } from 'vite';
|
||||||
import type { AstroConfig } from '../../@types/astro.js';
|
import type { AstroConfig } from '../../types/public/config.js';
|
||||||
import type { ViteBuildReturn } from './types.js';
|
import type { ViteBuildReturn } from './types.js';
|
||||||
|
|
||||||
export function getTimeStat(timeStart: number, timeEnd: number) {
|
export function getTimeStat(timeStart: number, timeEnd: number) {
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import type { TransformResult } from '@astrojs/compiler';
|
import type { TransformResult } from '@astrojs/compiler';
|
||||||
import type { ResolvedConfig } from 'vite';
|
import type { ResolvedConfig } from 'vite';
|
||||||
import type { AstroConfig } from '../../@types/astro.js';
|
|
||||||
|
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import { transform } from '@astrojs/compiler';
|
import { transform } from '@astrojs/compiler';
|
||||||
import { normalizePath } from 'vite';
|
import { normalizePath } from 'vite';
|
||||||
import type { AstroPreferences } from '../../preferences/index.js';
|
import type { AstroPreferences } from '../../preferences/index.js';
|
||||||
|
import type { AstroConfig } from '../../types/public/config.js';
|
||||||
import type { AstroError } from '../errors/errors.js';
|
import type { AstroError } from '../errors/errors.js';
|
||||||
import { AggregateError, CompilerError } from '../errors/errors.js';
|
import { AggregateError, CompilerError } from '../errors/errors.js';
|
||||||
import { AstroErrorData } from '../errors/index.js';
|
import { AstroErrorData } from '../errors/index.js';
|
||||||
|
|
|
@ -3,13 +3,13 @@ import path from 'node:path';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import * as colors from 'kleur/colors';
|
import * as colors from 'kleur/colors';
|
||||||
import { ZodError } from 'zod';
|
import { ZodError } from 'zod';
|
||||||
|
import { eventConfigError, telemetry } from '../../events/index.js';
|
||||||
import type {
|
import type {
|
||||||
AstroConfig,
|
AstroConfig,
|
||||||
AstroInlineConfig,
|
AstroInlineConfig,
|
||||||
AstroInlineOnlyConfig,
|
AstroInlineOnlyConfig,
|
||||||
AstroUserConfig,
|
AstroUserConfig,
|
||||||
} from '../../@types/astro.js';
|
} from '../../types/public/config.js';
|
||||||
import { eventConfigError, telemetry } from '../../events/index.js';
|
|
||||||
import { trackAstroConfigZodError } from '../errors/errors.js';
|
import { trackAstroConfigZodError } from '../errors/errors.js';
|
||||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||||
import { formatConfigErrorMessage } from '../messages.js';
|
import { formatConfigErrorMessage } from '../messages.js';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { AstroInlineConfig } from '../../@types/astro.js';
|
import type { AstroInlineConfig } from '../../types/public/config.js';
|
||||||
import { Logger } from '../logger/core.js';
|
import { Logger } from '../logger/core.js';
|
||||||
import { nodeLogDestination } from '../logger/node.js';
|
import { nodeLogDestination } from '../logger/node.js';
|
||||||
|
|
||||||
|
|
|
@ -6,13 +6,13 @@ import type {
|
||||||
} from '@astrojs/markdown-remark';
|
} from '@astrojs/markdown-remark';
|
||||||
import { markdownConfigDefaults } from '@astrojs/markdown-remark';
|
import { markdownConfigDefaults } from '@astrojs/markdown-remark';
|
||||||
import { type BuiltinTheme, bundledThemes } from 'shiki';
|
import { type BuiltinTheme, bundledThemes } from 'shiki';
|
||||||
import type { AstroUserConfig, ViteUserConfig } from '../../@types/astro.js';
|
|
||||||
|
|
||||||
import type { OutgoingHttpHeaders } from 'node:http';
|
import type { OutgoingHttpHeaders } from 'node:http';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import { pathToFileURL } from 'node:url';
|
import { pathToFileURL } from 'node:url';
|
||||||
import { z } from 'zod';
|
import { z } from 'zod';
|
||||||
import { EnvSchema } from '../../env/schema.js';
|
import { EnvSchema } from '../../env/schema.js';
|
||||||
|
import type { AstroUserConfig, ViteUserConfig } from '../../types/public/config.js';
|
||||||
import { appendForwardSlash, prependForwardSlash, removeTrailingForwardSlash } from '../path.js';
|
import { appendForwardSlash, prependForwardSlash, removeTrailingForwardSlash } from '../path.js';
|
||||||
|
|
||||||
// The below types are required boilerplate to workaround a Zod issue since v3.21.2. Since that version,
|
// The below types are required boilerplate to workaround a Zod issue since v3.21.2. Since that version,
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||||
import yaml from 'js-yaml';
|
import yaml from 'js-yaml';
|
||||||
import type { AstroConfig, AstroSettings } from '../../@types/astro.js';
|
|
||||||
import { getContentPaths } from '../../content/index.js';
|
import { getContentPaths } from '../../content/index.js';
|
||||||
import createPreferences from '../../preferences/index.js';
|
import createPreferences from '../../preferences/index.js';
|
||||||
|
import type { AstroSettings } from '../../types/astro.js';
|
||||||
|
import type { AstroConfig } from '../../types/public/config.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/index.js';
|
||||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { AstroConfig } from '../../@types/astro.js';
|
import type { AstroConfig } from '../../types/public/config.js';
|
||||||
import { createRelativeSchema } from './schema.js';
|
import { createRelativeSchema } from './schema.js';
|
||||||
|
|
||||||
/** Turn raw config values into normalized values */
|
/** Turn raw config values into normalized values */
|
||||||
|
|
|
@ -3,7 +3,6 @@ import { fileURLToPath } from 'node:url';
|
||||||
import glob from 'fast-glob';
|
import glob from 'fast-glob';
|
||||||
import * as vite from 'vite';
|
import * as vite from 'vite';
|
||||||
import { crawlFrameworkPkgs } from 'vitefu';
|
import { crawlFrameworkPkgs } from 'vitefu';
|
||||||
import type { AstroSettings } from '../@types/astro.js';
|
|
||||||
import { getAssetsPrefix } from '../assets/utils/getAssetsPrefix.js';
|
import { getAssetsPrefix } from '../assets/utils/getAssetsPrefix.js';
|
||||||
import astroAssetsPlugin from '../assets/vite-plugin-assets.js';
|
import astroAssetsPlugin from '../assets/vite-plugin-assets.js';
|
||||||
import astroContainer from '../container/vite-plugin-container.js';
|
import astroContainer from '../container/vite-plugin-container.js';
|
||||||
|
@ -17,6 +16,7 @@ import astroInternationalization from '../i18n/vite-plugin-i18n.js';
|
||||||
import astroPrefetch from '../prefetch/vite-plugin-prefetch.js';
|
import astroPrefetch from '../prefetch/vite-plugin-prefetch.js';
|
||||||
import astroDevToolbar from '../toolbar/vite-plugin-dev-toolbar.js';
|
import astroDevToolbar from '../toolbar/vite-plugin-dev-toolbar.js';
|
||||||
import astroTransitions from '../transitions/vite-plugin-transitions.js';
|
import astroTransitions from '../transitions/vite-plugin-transitions.js';
|
||||||
|
import type { AstroSettings } from '../types/astro.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';
|
||||||
import astroVitePlugin from '../vite-plugin-astro/index.js';
|
import astroVitePlugin from '../vite-plugin-astro/index.js';
|
||||||
|
@ -185,7 +185,7 @@ export async function createVite(
|
||||||
{
|
{
|
||||||
// Typings are imported from 'astro' (e.g. import { Type } from 'astro')
|
// Typings are imported from 'astro' (e.g. import { Type } from 'astro')
|
||||||
find: /^astro$/,
|
find: /^astro$/,
|
||||||
replacement: fileURLToPath(new URL('../@types/astro.js', import.meta.url)),
|
replacement: fileURLToPath(new URL('../types/public/index.js', import.meta.url)),
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
find: 'astro:middleware',
|
find: 'astro:middleware',
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import type * as http from 'node:http';
|
import type * as http from 'node:http';
|
||||||
import type { AddressInfo } from 'node:net';
|
import type { AddressInfo } from 'node:net';
|
||||||
import type { AstroInlineConfig, AstroSettings } from '../../@types/astro.js';
|
import type { AstroSettings } from '../../types/astro.js';
|
||||||
|
|
||||||
import nodeFs from 'node:fs';
|
import nodeFs from 'node:fs';
|
||||||
import * as vite from 'vite';
|
import * as vite from 'vite';
|
||||||
|
@ -11,6 +11,7 @@ import {
|
||||||
runHookServerDone,
|
runHookServerDone,
|
||||||
runHookServerStart,
|
runHookServerStart,
|
||||||
} from '../../integrations/hooks.js';
|
} from '../../integrations/hooks.js';
|
||||||
|
import type { AstroInlineConfig } from '../../types/public/config.js';
|
||||||
import { createVite } from '../create-vite.js';
|
import { createVite } from '../create-vite.js';
|
||||||
import type { Logger } from '../logger/core.js';
|
import type { Logger } from '../logger/core.js';
|
||||||
import { apply as applyPolyfill } from '../polyfill.js';
|
import { apply as applyPolyfill } from '../polyfill.js';
|
||||||
|
|
|
@ -5,13 +5,13 @@ import { performance } from 'node:perf_hooks';
|
||||||
import { green } from 'kleur/colors';
|
import { green } from 'kleur/colors';
|
||||||
import { gt, major, minor, patch } from 'semver';
|
import { gt, major, minor, patch } from 'semver';
|
||||||
import type * as vite from 'vite';
|
import type * as vite from 'vite';
|
||||||
import type { AstroInlineConfig } from '../../@types/astro.js';
|
|
||||||
import { DATA_STORE_FILE } from '../../content/consts.js';
|
import { DATA_STORE_FILE } from '../../content/consts.js';
|
||||||
import { globalContentLayer } from '../../content/content-layer.js';
|
import { globalContentLayer } from '../../content/content-layer.js';
|
||||||
import { attachContentServerListeners } from '../../content/index.js';
|
import { attachContentServerListeners } from '../../content/index.js';
|
||||||
import { MutableDataStore } from '../../content/mutable-data-store.js';
|
import { MutableDataStore } from '../../content/mutable-data-store.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 type { AstroInlineConfig } from '../../types/public/config.js';
|
||||||
import * as msg from '../messages.js';
|
import * as msg from '../messages.js';
|
||||||
import { ensureProcessNodeEnv } from '../util.js';
|
import { ensureProcessNodeEnv } from '../util.js';
|
||||||
import { startContainer } from './container.js';
|
import { startContainer } from './container.js';
|
||||||
|
|
|
@ -1,9 +1,10 @@
|
||||||
import type nodeFs from 'node:fs';
|
import type nodeFs from 'node:fs';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import * as vite from 'vite';
|
import * as vite from 'vite';
|
||||||
import type { AstroInlineConfig, AstroSettings } from '../../@types/astro.js';
|
|
||||||
import { globalContentLayer } from '../../content/content-layer.js';
|
import { globalContentLayer } from '../../content/content-layer.js';
|
||||||
import { eventCliSession, telemetry } from '../../events/index.js';
|
import { eventCliSession, telemetry } from '../../events/index.js';
|
||||||
|
import type { AstroSettings } from '../../types/astro.js';
|
||||||
|
import type { AstroInlineConfig } from '../../types/public/config.js';
|
||||||
import { createNodeLogger, createSettings, resolveConfig } from '../config/index.js';
|
import { createNodeLogger, createSettings, resolveConfig } from '../config/index.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';
|
||||||
|
|
|
@ -6,7 +6,7 @@ import { bold, underline } from 'kleur/colors';
|
||||||
import stripAnsi from 'strip-ansi';
|
import stripAnsi from 'strip-ansi';
|
||||||
import type { ESBuildTransformResult } from 'vite';
|
import type { ESBuildTransformResult } from 'vite';
|
||||||
import { normalizePath } from 'vite';
|
import { normalizePath } from 'vite';
|
||||||
import type { SSRError } from '../../../@types/astro.js';
|
import type { SSRError } from '../../../types/public/internal.js';
|
||||||
import { removeLeadingForwardSlashWindows } from '../../path.js';
|
import { removeLeadingForwardSlashWindows } from '../../path.js';
|
||||||
import { AggregateError, type ErrorWithMetadata } from '../errors.js';
|
import { AggregateError, type ErrorWithMetadata } from '../errors.js';
|
||||||
import { AstroErrorData } from '../index.js';
|
import { AstroErrorData } from '../index.js';
|
||||||
|
|
|
@ -3,11 +3,11 @@ import { fileURLToPath } from 'node:url';
|
||||||
import { codeToHtml, createCssVariablesTheme } from 'shiki';
|
import { codeToHtml, createCssVariablesTheme } from 'shiki';
|
||||||
import type { ShikiTransformer } from 'shiki';
|
import type { ShikiTransformer } from 'shiki';
|
||||||
import type { ErrorPayload } from 'vite';
|
import type { ErrorPayload } from 'vite';
|
||||||
|
import type { SSRLoadedRenderer } from '../../../types/public/internal.js';
|
||||||
import type { ModuleLoader } from '../../module-loader/index.js';
|
import type { ModuleLoader } from '../../module-loader/index.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';
|
||||||
import type { SSRLoadedRenderer } from './../../../@types/astro.js';
|
|
||||||
import { getDocsForError, renderErrorMarkdown } from './utils.js';
|
import { getDocsForError, renderErrorMarkdown } from './utils.js';
|
||||||
|
|
||||||
export function enhanceViteSSRError({
|
export function enhanceViteSSRError({
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// BEFORE ADDING AN ERROR: Please look at the README.md in this folder for general guidelines on writing error messages
|
// BEFORE ADDING AN ERROR: Please look at the README.md in this folder for general guidelines on writing error messages
|
||||||
// Additionally, this code, much like `@types/astro.ts`, is used to generate documentation, so make sure to pass
|
// Additionally, this code, much like `types/public/config.ts`, is used to generate documentation, so make sure to pass
|
||||||
// your changes by our wonderful docs team before merging!
|
// your changes by our wonderful docs team before merging!
|
||||||
|
|
||||||
import type { ZodError } from 'zod';
|
import type { ZodError } from 'zod';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import type { YAMLException } from 'js-yaml';
|
import type { YAMLException } from 'js-yaml';
|
||||||
import type { ErrorPayload as ViteErrorPayload } from 'vite';
|
import type { ErrorPayload as ViteErrorPayload } from 'vite';
|
||||||
import type { SSRError } from '../../@types/astro.js';
|
import type { SSRError } from '../../types/public/internal.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the line and character based on the offset
|
* Get the line and character based on the offset
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
// This is the main entrypoint when importing the `astro` package.
|
// This is the main entrypoint when importing the `astro` package.
|
||||||
|
|
||||||
import type { AstroInlineConfig } from '../@types/astro.js';
|
import type { AstroInlineConfig } from '../types/public/config.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';
|
||||||
|
|
||||||
|
|
|
@ -1,9 +1,9 @@
|
||||||
import type {
|
import type {
|
||||||
APIContext,
|
|
||||||
MiddlewareHandler,
|
MiddlewareHandler,
|
||||||
MiddlewareNext,
|
MiddlewareNext,
|
||||||
RewritePayload,
|
RewritePayload,
|
||||||
} from '../../@types/astro.js';
|
} from '../../types/public/common.js';
|
||||||
|
import type { APIContext } from '../../types/public/context.js';
|
||||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,10 +1,11 @@
|
||||||
import type { APIContext, MiddlewareHandler, Params, RewritePayload } from '../../@types/astro.js';
|
|
||||||
import { createCallAction, createGetActionResult } from '../../actions/utils.js';
|
import { createCallAction, createGetActionResult } from '../../actions/utils.js';
|
||||||
import {
|
import {
|
||||||
computeCurrentLocale,
|
computeCurrentLocale,
|
||||||
computePreferredLocale,
|
computePreferredLocale,
|
||||||
computePreferredLocaleList,
|
computePreferredLocaleList,
|
||||||
} from '../../i18n/utils.js';
|
} from '../../i18n/utils.js';
|
||||||
|
import type { MiddlewareHandler, Params, RewritePayload } from '../../types/public/common.js';
|
||||||
|
import type { APIContext } from '../../types/public/context.js';
|
||||||
import { ASTRO_VERSION, clientAddressSymbol, clientLocalsSymbol } from '../constants.js';
|
import { ASTRO_VERSION, clientAddressSymbol, clientLocalsSymbol } from '../constants.js';
|
||||||
import { AstroCookies } from '../cookies/index.js';
|
import { AstroCookies } from '../cookies/index.js';
|
||||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import type { APIContext, MiddlewareHandler, RewritePayload } from '../../@types/astro.js';
|
import type { MiddlewareHandler, RewritePayload } from '../../types/public/common.js';
|
||||||
|
import type { APIContext } from '../../types/public/context.js';
|
||||||
import { AstroCookies } from '../cookies/cookies.js';
|
import { AstroCookies } from '../cookies/cookies.js';
|
||||||
import { defineMiddleware } from './index.js';
|
import { defineMiddleware } from './index.js';
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import type { Plugin as VitePlugin } from 'vite';
|
import type { Plugin as VitePlugin } from 'vite';
|
||||||
import { normalizePath } from 'vite';
|
import { normalizePath } from 'vite';
|
||||||
import type { AstroSettings } from '../../@types/astro.js';
|
|
||||||
import { getOutputDirectory } from '../../prerender/utils.js';
|
import { getOutputDirectory } from '../../prerender/utils.js';
|
||||||
|
import type { AstroSettings } from '../../types/astro.js';
|
||||||
import { addRollupInput } from '../build/add-rollup-input.js';
|
import { addRollupInput } from '../build/add-rollup-input.js';
|
||||||
import type { BuildInternals } from '../build/internal.js';
|
import type { BuildInternals } from '../build/internal.js';
|
||||||
import type { StaticBuildOptions } from '../build/types.js';
|
import type { StaticBuildOptions } from '../build/types.js';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { EventEmitter } from 'node:events';
|
import { EventEmitter } from 'node:events';
|
||||||
import type * as fs from 'node:fs';
|
import type * as fs from 'node:fs';
|
||||||
import type { TypedEventEmitter } from '../../@types/typed-emitter.js';
|
import type { TypedEventEmitter } from '../../types/typed-emitter.js';
|
||||||
|
|
||||||
// This is a generic interface for a module loader. In the astro cli this is
|
// This is a generic interface for a module loader. In the astro cli this is
|
||||||
// fulfilled by Vite, see vite.ts
|
// fulfilled by Vite, see vite.ts
|
||||||
|
|
|
@ -1,11 +1,12 @@
|
||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
import { createRequire } from 'node:module';
|
import { createRequire } from 'node:module';
|
||||||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||||
import type { AstroInlineConfig, PreviewModule, PreviewServer } from '../../@types/astro.js';
|
|
||||||
import { AstroIntegrationLogger } from '../../core/logger/core.js';
|
import { AstroIntegrationLogger } from '../../core/logger/core.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';
|
||||||
import { runHookConfigDone, runHookConfigSetup } from '../../integrations/hooks.js';
|
import { runHookConfigDone, runHookConfigSetup } from '../../integrations/hooks.js';
|
||||||
|
import type { AstroInlineConfig } from '../../types/public/config.js';
|
||||||
|
import type { PreviewModule, PreviewServer } from '../../types/public/preview.js';
|
||||||
import { resolveConfig } from '../config/config.js';
|
import { resolveConfig } from '../config/config.js';
|
||||||
import { createNodeLogger } from '../config/logging.js';
|
import { createNodeLogger } from '../config/logging.js';
|
||||||
import { createSettings } from '../config/settings.js';
|
import { createSettings } from '../config/settings.js';
|
||||||
|
|
|
@ -2,7 +2,7 @@ import type http from 'node:http';
|
||||||
import { performance } from 'node:perf_hooks';
|
import { performance } from 'node:perf_hooks';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import { type PreviewServer as VitePreviewServer, preview } from 'vite';
|
import { type PreviewServer as VitePreviewServer, preview } from 'vite';
|
||||||
import type { AstroSettings } from '../../@types/astro.js';
|
import type { AstroSettings } from '../../types/astro.js';
|
||||||
import type { Logger } from '../logger/core.js';
|
import type { Logger } from '../logger/core.js';
|
||||||
import * as msg from '../messages.js';
|
import * as msg from '../messages.js';
|
||||||
import { getResolvedHostForHttpServer } from './util.js';
|
import { getResolvedHostForHttpServer } from './util.js';
|
||||||
|
|
|
@ -2,8 +2,8 @@ import fs from 'node:fs';
|
||||||
import type { IncomingMessage, ServerResponse } from 'node:http';
|
import type { IncomingMessage, ServerResponse } from 'node:http';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import type { Connect, Plugin } from 'vite';
|
import type { Connect, Plugin } from 'vite';
|
||||||
import type { AstroSettings } from '../../@types/astro.js';
|
|
||||||
import { notFoundTemplate, subpathNotUsedTemplate } from '../../template/4xx.js';
|
import { notFoundTemplate, subpathNotUsedTemplate } from '../../template/4xx.js';
|
||||||
|
import type { AstroSettings } from '../../types/astro.js';
|
||||||
import { cleanUrl } from '../../vite-plugin-utils/index.js';
|
import { cleanUrl } from '../../vite-plugin-utils/index.js';
|
||||||
import { stripBase } from './util.js';
|
import { stripBase } from './util.js';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { ComponentInstance } from '../../@types/astro.js';
|
import type { ComponentInstance } from '../../types/astro.js';
|
||||||
import type { SinglePageBuiltModule } from '../build/types.js';
|
import type { SinglePageBuiltModule } from '../build/types.js';
|
||||||
|
|
||||||
// A stub of a component instance for a given route
|
// A stub of a component instance for a given route
|
||||||
|
|
|
@ -1,4 +1,8 @@
|
||||||
import type { RedirectRouteData, RouteData } from '../../@types/astro.js';
|
import type { RouteData } from '../../types/public/internal.js';
|
||||||
|
|
||||||
|
type RedirectRouteData = RouteData & {
|
||||||
|
redirect: string;
|
||||||
|
};
|
||||||
|
|
||||||
export function routeIsRedirect(route: RouteData | undefined): route is RedirectRouteData {
|
export function routeIsRedirect(route: RouteData | undefined): route is RedirectRouteData {
|
||||||
return route?.type === 'redirect';
|
return route?.type === 'redirect';
|
||||||
|
|
|
@ -1,14 +1,3 @@
|
||||||
import type {
|
|
||||||
APIContext,
|
|
||||||
AstroGlobal,
|
|
||||||
AstroGlobalPartial,
|
|
||||||
ComponentInstance,
|
|
||||||
MiddlewareHandler,
|
|
||||||
Props,
|
|
||||||
RewritePayload,
|
|
||||||
RouteData,
|
|
||||||
SSRResult,
|
|
||||||
} from '../@types/astro.js';
|
|
||||||
import type { ActionAPIContext } from '../actions/runtime/utils.js';
|
import type { ActionAPIContext } from '../actions/runtime/utils.js';
|
||||||
import { deserializeActionResult } from '../actions/runtime/virtual/shared.js';
|
import { deserializeActionResult } from '../actions/runtime/virtual/shared.js';
|
||||||
import { createCallAction, createGetActionResult, hasActionPayload } from '../actions/utils.js';
|
import { createCallAction, createGetActionResult, hasActionPayload } from '../actions/utils.js';
|
||||||
|
@ -19,6 +8,10 @@ import {
|
||||||
} from '../i18n/utils.js';
|
} from '../i18n/utils.js';
|
||||||
import { renderEndpoint } from '../runtime/server/endpoint.js';
|
import { renderEndpoint } from '../runtime/server/endpoint.js';
|
||||||
import { renderPage } from '../runtime/server/index.js';
|
import { renderPage } from '../runtime/server/index.js';
|
||||||
|
import type { ComponentInstance } from '../types/astro.js';
|
||||||
|
import type { MiddlewareHandler, Props, RewritePayload } from '../types/public/common.js';
|
||||||
|
import type { APIContext, AstroGlobal, AstroGlobalPartial } from '../types/public/context.js';
|
||||||
|
import type { RouteData, SSRResult } from '../types/public/internal.js';
|
||||||
import {
|
import {
|
||||||
ASTRO_VERSION,
|
ASTRO_VERSION,
|
||||||
REROUTE_DIRECTIVE_HEADER,
|
REROUTE_DIRECTIVE_HEADER,
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import type { ComponentInstance, RouteData } from '../../@types/astro.js';
|
import type { ComponentInstance } from '../../types/astro.js';
|
||||||
|
import type { RouteData } from '../../types/public/internal.js';
|
||||||
import type { Pipeline } from '../base-pipeline.js';
|
import type { Pipeline } from '../base-pipeline.js';
|
||||||
export { Pipeline } from '../base-pipeline.js';
|
export { Pipeline } from '../base-pipeline.js';
|
||||||
export { getParams, getProps } from './params-and-props.js';
|
export { getParams, getProps } from './params-and-props.js';
|
||||||
|
|
|
@ -4,8 +4,8 @@ import type {
|
||||||
PaginateOptions,
|
PaginateOptions,
|
||||||
Params,
|
Params,
|
||||||
Props,
|
Props,
|
||||||
RouteData,
|
} from '../../types/public/common.js';
|
||||||
} from '../../@types/astro.js';
|
import type { RouteData } from '../../types/public/internal.js';
|
||||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||||
|
|
||||||
export function generatePaginateFunction(
|
export function generatePaginateFunction(
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
import type { ComponentInstance, Params, Props, RouteData } from '../../@types/astro.js';
|
import type { ComponentInstance } from '../../types/astro.js';
|
||||||
|
import type { Params, Props } from '../../types/public/common.js';
|
||||||
|
import type { RouteData } from '../../types/public/internal.js';
|
||||||
import { DEFAULT_404_COMPONENT } from '../constants.js';
|
import { DEFAULT_404_COMPONENT } from '../constants.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,4 +1,5 @@
|
||||||
import type { AstroRenderer, SSRLoadedRenderer } from '../../@types/astro.js';
|
import type { AstroRenderer } from '../../types/public/integrations.js';
|
||||||
|
import type { SSRLoadedRenderer } from '../../types/public/internal.js';
|
||||||
import type { ModuleLoader } from '../module-loader/index.js';
|
import type { ModuleLoader } from '../module-loader/index.js';
|
||||||
|
|
||||||
export async function loadRenderer(
|
export async function loadRenderer(
|
||||||
|
|
|
@ -1,13 +1,13 @@
|
||||||
|
import type { ComponentInstance } from '../../types/astro.js';
|
||||||
import type {
|
import type {
|
||||||
ComponentInstance,
|
|
||||||
GetStaticPathsItem,
|
GetStaticPathsItem,
|
||||||
GetStaticPathsResult,
|
GetStaticPathsResult,
|
||||||
GetStaticPathsResultKeyed,
|
GetStaticPathsResultKeyed,
|
||||||
PaginateFunction,
|
PaginateFunction,
|
||||||
Params,
|
Params,
|
||||||
RouteData,
|
} from '../../types/public/common.js';
|
||||||
RuntimeMode,
|
import type { RuntimeMode } from '../../types/public/config.js';
|
||||||
} from '../../@types/astro.js';
|
import type { RouteData } from '../../types/public/internal.js';
|
||||||
import type { Logger } from '../logger/core.js';
|
import type { Logger } from '../logger/core.js';
|
||||||
|
|
||||||
import { stringifyParams } from '../routing/params.js';
|
import { stringifyParams } from '../routing/params.js';
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
import type { SSRResult } from '../../@types/astro.js';
|
|
||||||
import { type ComponentSlots, renderSlotToString } from '../../runtime/server/index.js';
|
import { type ComponentSlots, renderSlotToString } 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 { isRenderInstruction } from '../../runtime/server/render/instruction.js';
|
import { isRenderInstruction } from '../../runtime/server/render/instruction.js';
|
||||||
|
import type { SSRResult } from '../../types/public/internal.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,7 +1,7 @@
|
||||||
import type { AssetsPrefix, SSRElement } from '../../@types/astro.js';
|
|
||||||
import { getAssetsPrefix } from '../../assets/utils/getAssetsPrefix.js';
|
import { getAssetsPrefix } from '../../assets/utils/getAssetsPrefix.js';
|
||||||
import { fileExtension, joinPaths, prependForwardSlash, slash } from '../../core/path.js';
|
import { fileExtension, joinPaths, prependForwardSlash, slash } from '../../core/path.js';
|
||||||
import type { StylesheetAsset } from '../app/types.js';
|
import type { SSRElement } from '../../types/public/internal.js';
|
||||||
|
import type { AssetsPrefix, StylesheetAsset } from '../app/types.js';
|
||||||
|
|
||||||
export function createAssetLink(href: string, base?: string, assetsPrefix?: AssetsPrefix): string {
|
export function createAssetLink(href: string, base?: string, assetsPrefix?: AssetsPrefix): string {
|
||||||
if (assetsPrefix) {
|
if (assetsPrefix) {
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import type { ComponentInstance, ManifestData, RouteData } from '../../@types/astro.js';
|
|
||||||
import notFoundTemplate from '../../template/4xx.js';
|
import notFoundTemplate from '../../template/4xx.js';
|
||||||
|
import type { ComponentInstance, ManifestData } from '../../types/astro.js';
|
||||||
|
import type { RouteData } from '../../types/public/internal.js';
|
||||||
import { DEFAULT_404_COMPONENT, DEFAULT_500_COMPONENT } from '../constants.js';
|
import { DEFAULT_404_COMPONENT, DEFAULT_500_COMPONENT } from '../constants.js';
|
||||||
|
|
||||||
export const DEFAULT_404_ROUTE: RouteData = {
|
export const DEFAULT_404_ROUTE: RouteData = {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import type { ComponentInstance, ManifestData, SSRManifest } from '../../@types/astro.js';
|
import type { ComponentInstance, ManifestData } from '../../types/astro.js';
|
||||||
|
import type { SSRManifest } from '../app/types.js';
|
||||||
import { DEFAULT_404_COMPONENT } from '../constants.js';
|
import { DEFAULT_404_COMPONENT } from '../constants.js';
|
||||||
import {
|
import {
|
||||||
SERVER_ISLAND_COMPONENT,
|
SERVER_ISLAND_COMPONENT,
|
||||||
|
|
|
@ -1,11 +1,4 @@
|
||||||
import type {
|
import type { AstroSettings, ManifestData } from '../../../types/astro.js';
|
||||||
AstroConfig,
|
|
||||||
AstroSettings,
|
|
||||||
ManifestData,
|
|
||||||
RouteData,
|
|
||||||
RoutePart,
|
|
||||||
RoutePriorityOverride,
|
|
||||||
} from '../../../@types/astro.js';
|
|
||||||
import type { Logger } from '../../logger/core.js';
|
import type { Logger } from '../../logger/core.js';
|
||||||
|
|
||||||
import nodeFs from 'node:fs';
|
import nodeFs from 'node:fs';
|
||||||
|
@ -15,6 +8,9 @@ import { fileURLToPath } from 'node:url';
|
||||||
import { bold } from 'kleur/colors';
|
import { bold } from 'kleur/colors';
|
||||||
import { toRoutingStrategy } from '../../../i18n/utils.js';
|
import { toRoutingStrategy } from '../../../i18n/utils.js';
|
||||||
import { getPrerenderDefault } from '../../../prerender/utils.js';
|
import { getPrerenderDefault } from '../../../prerender/utils.js';
|
||||||
|
import type { AstroConfig } from '../../../types/public/config.js';
|
||||||
|
import type { RoutePriorityOverride } from '../../../types/public/integrations.js';
|
||||||
|
import type { RouteData, RoutePart } from '../../../types/public/internal.js';
|
||||||
import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from '../../constants.js';
|
import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from '../../constants.js';
|
||||||
import { MissingIndexForInternationalization } from '../../errors/errors-data.js';
|
import { MissingIndexForInternationalization } from '../../errors/errors-data.js';
|
||||||
import { AstroError } from '../../errors/index.js';
|
import { AstroError } from '../../errors/index.js';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import type { AstroConfig, RoutePart } from '../../../@types/astro.js';
|
|
||||||
|
|
||||||
import { compile } from 'path-to-regexp';
|
import { compile } from 'path-to-regexp';
|
||||||
|
import type { AstroConfig } from '../../../types/public/config.js';
|
||||||
|
import type { RoutePart } from '../../../types/public/internal.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sanitizes the parameters object by normalizing string values and replacing certain characters with their URL-encoded equivalents.
|
* Sanitizes the parameters object by normalizing string values and replacing certain characters with their URL-encoded equivalents.
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Reference in a new issue