config: migrate us to moduleResolution: 'node16' (#8519)
This commit is contained in:
parent
b85c8a78a1
commit
4e395a6cab
220 changed files with 346 additions and 404 deletions
|
@ -2,9 +2,6 @@
|
||||||
"extends": "../../../tsconfig.base.json",
|
"extends": "../../../tsconfig.base.json",
|
||||||
"include": ["src"],
|
"include": ["src"],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"allowJs": true,
|
"outDir": "./dist"
|
||||||
"module": "ES2022",
|
|
||||||
"outDir": "./dist",
|
|
||||||
"target": "ES2022"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,6 @@
|
||||||
"extends": "../../tsconfig.base.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"include": ["src"],
|
"include": ["src"],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"allowJs": true,
|
|
||||||
"target": "ES2022",
|
|
||||||
"module": "ES2022",
|
|
||||||
"outDir": "./dist"
|
"outDir": "./dist"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { z } from 'astro/zod';
|
import type { z } from 'astro/zod';
|
||||||
import type { RSSOptions } from './index';
|
import type { RSSOptions } from './index.js';
|
||||||
|
|
||||||
/** Normalize URL to its canonical form */
|
/** Normalize URL to its canonical form */
|
||||||
export function createCanonicalURL(
|
export function createCanonicalURL(
|
||||||
|
|
|
@ -2,10 +2,6 @@
|
||||||
"extends": "../../tsconfig.base.json",
|
"extends": "../../tsconfig.base.json",
|
||||||
"include": ["src"],
|
"include": ["src"],
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"allowJs": true,
|
"outDir": "./dist"
|
||||||
"module": "ES2022",
|
|
||||||
"outDir": "./dist",
|
|
||||||
"target": "ES2022",
|
|
||||||
"strictNullChecks": true
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
8
packages/astro/client.d.ts
vendored
8
packages/astro/client.d.ts
vendored
|
@ -52,7 +52,7 @@ declare module 'astro:assets' {
|
||||||
| import('./dist/assets/types.js').ImageTransform
|
| import('./dist/assets/types.js').ImageTransform
|
||||||
| import('./dist/assets/types.js').UnresolvedImageTransform
|
| 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').AstroConfig['image'];
|
imageConfig: import('./dist/@types/astro.js').AstroConfig['image'];
|
||||||
getConfiguredImageService: typeof import('./dist/assets/index.js').getConfiguredImageService;
|
getConfiguredImageService: typeof import('./dist/assets/index.js').getConfiguredImageService;
|
||||||
Image: typeof import('./components/Image.astro').default;
|
Image: typeof import('./components/Image.astro').default;
|
||||||
};
|
};
|
||||||
|
@ -126,7 +126,7 @@ declare module 'astro:components' {
|
||||||
export * from 'astro/components';
|
export * from 'astro/components';
|
||||||
}
|
}
|
||||||
|
|
||||||
type MD = import('./dist/@types/astro').MarkdownInstance<Record<string, any>>;
|
type MD = import('./dist/@types/astro.js').MarkdownInstance<Record<string, any>>;
|
||||||
interface ExportedMarkdownModuleEntities {
|
interface ExportedMarkdownModuleEntities {
|
||||||
frontmatter: MD['frontmatter'];
|
frontmatter: MD['frontmatter'];
|
||||||
file: MD['file'];
|
file: MD['file'];
|
||||||
|
@ -231,7 +231,7 @@ declare module '*.mdown' {
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module '*.mdx' {
|
declare module '*.mdx' {
|
||||||
type MDX = import('./dist/@types/astro').MDXInstance<Record<string, any>>;
|
type MDX = import('./dist/@types/astro.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'];
|
||||||
|
@ -244,7 +244,7 @@ declare module '*.mdx' {
|
||||||
}
|
}
|
||||||
|
|
||||||
declare module 'astro:ssr-manifest' {
|
declare module 'astro:ssr-manifest' {
|
||||||
export const manifest: import('./dist/@types/astro').SSRManifest;
|
export const manifest: import('./dist/@types/astro.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`)
|
||||||
|
|
|
@ -13,16 +13,16 @@ import type { AddressInfo } from 'node:net';
|
||||||
import type * as rollup from 'rollup';
|
import type * as rollup from 'rollup';
|
||||||
import type { TsConfigJson } from 'tsconfig-resolver';
|
import type { TsConfigJson } from 'tsconfig-resolver';
|
||||||
import type * as vite from 'vite';
|
import type * as vite from 'vite';
|
||||||
import type { RemotePattern } from '../assets/utils/remotePattern';
|
import type { RemotePattern } from '../assets/utils/remotePattern.js';
|
||||||
import type { SerializedSSRManifest } from '../core/app/types';
|
import type { SerializedSSRManifest } from '../core/app/types.js';
|
||||||
import type { PageBuildData } from '../core/build/types';
|
import type { PageBuildData } from '../core/build/types.js';
|
||||||
import type { AstroConfigType } from '../core/config';
|
import type { AstroConfigType } from '../core/config/index.js';
|
||||||
import type { AstroTimer } from '../core/config/timer';
|
import type { AstroTimer } from '../core/config/timer.js';
|
||||||
import type { AstroCookies } from '../core/cookies';
|
import type { AstroCookies } from '../core/cookies/index.js';
|
||||||
import type { ResponseWithEncoding } from '../core/endpoint/index.js';
|
import type { ResponseWithEncoding } from '../core/endpoint/index.js';
|
||||||
import type { AstroIntegrationLogger, Logger, LoggerLevel } from '../core/logger/core';
|
import type { AstroIntegrationLogger, Logger, LoggerLevel } from '../core/logger/core.js';
|
||||||
import type { AstroComponentFactory, AstroComponentInstance } from '../runtime/server';
|
import type { AstroComponentFactory, AstroComponentInstance } from '../runtime/server/index.js';
|
||||||
import type { OmitIndexSignature, Simplify } from '../type-utils';
|
import type { OmitIndexSignature, Simplify } from '../type-utils.js';
|
||||||
import type { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from './../core/constants.js';
|
import type { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from './../core/constants.js';
|
||||||
|
|
||||||
export { type AstroIntegrationLogger };
|
export { type AstroIntegrationLogger };
|
||||||
|
@ -39,7 +39,7 @@ export type {
|
||||||
ExternalImageService,
|
ExternalImageService,
|
||||||
ImageService,
|
ImageService,
|
||||||
LocalImageService,
|
LocalImageService,
|
||||||
} from '../assets/services/service';
|
} from '../assets/services/service.js';
|
||||||
export type {
|
export type {
|
||||||
GetImageResult,
|
GetImageResult,
|
||||||
ImageInputFormat,
|
ImageInputFormat,
|
||||||
|
@ -48,10 +48,10 @@ export type {
|
||||||
ImageQuality,
|
ImageQuality,
|
||||||
ImageQualityPreset,
|
ImageQualityPreset,
|
||||||
ImageTransform,
|
ImageTransform,
|
||||||
} from '../assets/types';
|
} from '../assets/types.js';
|
||||||
export type { RemotePattern } from '../assets/utils/remotePattern';
|
export type { RemotePattern } from '../assets/utils/remotePattern.js';
|
||||||
export type { SSRManifest } from '../core/app/types';
|
export type { SSRManifest } from '../core/app/types.js';
|
||||||
export type { AstroCookies } from '../core/cookies';
|
export type { AstroCookies } from '../core/cookies/index.js';
|
||||||
|
|
||||||
export interface AstroBuiltinProps {
|
export interface AstroBuiltinProps {
|
||||||
'client:load'?: boolean;
|
'client:load'?: boolean;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import fs, { readFileSync } from 'node:fs';
|
import fs, { readFileSync } from 'node:fs';
|
||||||
import { basename, join } from 'node:path/posix';
|
import { basename, join } from 'node:path/posix';
|
||||||
import type { BuildPipeline } from '../../core/build/buildPipeline';
|
import type { BuildPipeline } from '../../core/build/buildPipeline.js';
|
||||||
import { prependForwardSlash } from '../../core/path.js';
|
import { prependForwardSlash } from '../../core/path.js';
|
||||||
import { isServerLikeOutput } from '../../prerender/utils.js';
|
import { isServerLikeOutput } from '../../prerender/utils.js';
|
||||||
import { getConfiguredImageService, isESMImportedImage } from '../internal.js';
|
import { getConfiguredImageService, isESMImportedImage } from '../internal.js';
|
||||||
|
|
|
@ -33,7 +33,7 @@ export interface RotateOptions {
|
||||||
}
|
}
|
||||||
|
|
||||||
// MozJPEG
|
// MozJPEG
|
||||||
import type { MozJPEGModule as MozJPEGEncodeModule } from './mozjpeg/mozjpeg_enc'
|
import type { MozJPEGModule as MozJPEGEncodeModule } from './mozjpeg/mozjpeg_enc.js'
|
||||||
import mozDec from './mozjpeg/mozjpeg_node_dec.js'
|
import mozDec from './mozjpeg/mozjpeg_node_dec.js'
|
||||||
import mozDecWasm from './mozjpeg/mozjpeg_node_dec.wasm.js'
|
import mozDecWasm from './mozjpeg/mozjpeg_node_dec.wasm.js'
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ import mozEnc from './mozjpeg/mozjpeg_node_enc.js'
|
||||||
import mozEncWasm from './mozjpeg/mozjpeg_node_enc.wasm.js'
|
import mozEncWasm from './mozjpeg/mozjpeg_node_enc.wasm.js'
|
||||||
|
|
||||||
// WebP
|
// WebP
|
||||||
import type { WebPModule as WebPEncodeModule } from './webp/webp_enc'
|
import type { WebPModule as WebPEncodeModule } from './webp/webp_enc.js'
|
||||||
import webpDec from './webp/webp_node_dec.js'
|
import webpDec from './webp/webp_node_dec.js'
|
||||||
import webpDecWasm from './webp/webp_node_dec.wasm.js'
|
import webpDecWasm from './webp/webp_node_dec.wasm.js'
|
||||||
|
|
||||||
|
@ -49,7 +49,7 @@ import webpEnc from './webp/webp_node_enc.js'
|
||||||
import webpEncWasm from './webp/webp_node_enc.wasm.js'
|
import webpEncWasm from './webp/webp_node_enc.wasm.js'
|
||||||
|
|
||||||
// AVIF
|
// AVIF
|
||||||
import type { AVIFModule as AVIFEncodeModule } from './avif/avif_enc'
|
import type { AVIFModule as AVIFEncodeModule } from './avif/avif_enc.js'
|
||||||
import avifDec from './avif/avif_node_dec.js'
|
import avifDec from './avif/avif_node_dec.js'
|
||||||
import avifDecWasm from './avif/avif_node_dec.wasm.js'
|
import avifDecWasm from './avif/avif_node_dec.wasm.js'
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { IImage } from './interface'
|
import type { IImage } from './interface.js'
|
||||||
|
|
||||||
export const BMP: IImage = {
|
export const BMP: IImage = {
|
||||||
validate(buffer) {
|
validate(buffer) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { ICO } from './ico.js'
|
import { ICO } from './ico.js'
|
||||||
import type { IImage } from './interface'
|
import type { IImage } from './interface.js'
|
||||||
|
|
||||||
const TYPE_CURSOR = 2
|
const TYPE_CURSOR = 2
|
||||||
export const CUR: IImage = {
|
export const CUR: IImage = {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { IImage } from './interface'
|
import type { IImage } from './interface.js'
|
||||||
|
|
||||||
export const DDS: IImage = {
|
export const DDS: IImage = {
|
||||||
validate(buffer) {
|
validate(buffer) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { IImage } from './interface'
|
import type { IImage } from './interface.js'
|
||||||
|
|
||||||
const gifRegexp = /^GIF8[79]a/
|
const gifRegexp = /^GIF8[79]a/
|
||||||
export const GIF: IImage = {
|
export const GIF: IImage = {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { IImage, ISize } from './interface'
|
import type { IImage, ISize } from './interface.js'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ICNS Header
|
* ICNS Header
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { IImage, ISize, ISizeCalculationResult } from './interface'
|
import type { IImage, ISize, ISizeCalculationResult } from './interface.js'
|
||||||
|
|
||||||
const TYPE_ICON = 1
|
const TYPE_ICON = 1
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { IImage } from './interface'
|
import type { IImage } from './interface.js'
|
||||||
|
|
||||||
export const J2C: IImage = {
|
export const J2C: IImage = {
|
||||||
validate(buffer) {
|
validate(buffer) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { IImage, ISize } from './interface'
|
import type { IImage, ISize } from './interface.js'
|
||||||
|
|
||||||
const BoxTypes = {
|
const BoxTypes = {
|
||||||
ftyp: '66747970',
|
ftyp: '66747970',
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
// if this range we can't detect the file size correctly.
|
// if this range we can't detect the file size correctly.
|
||||||
|
|
||||||
import { readUInt } from '../readUInt.js'
|
import { readUInt } from '../readUInt.js'
|
||||||
import type { IImage, ISize } from './interface'
|
import type { IImage, ISize } from './interface.js'
|
||||||
|
|
||||||
const EXIF_MARKER = '45786966'
|
const EXIF_MARKER = '45786966'
|
||||||
const APP1_DATA_SIZE_BYTES = 2
|
const APP1_DATA_SIZE_BYTES = 2
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { IImage } from './interface'
|
import type { IImage } from './interface.js'
|
||||||
|
|
||||||
const SIGNATURE = 'KTX 11'
|
const SIGNATURE = 'KTX 11'
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { IImage } from './interface'
|
import type { IImage } from './interface.js'
|
||||||
|
|
||||||
const pngSignature = 'PNG\r\n\x1a\n'
|
const pngSignature = 'PNG\r\n\x1a\n'
|
||||||
const pngImageHeaderChunkName = 'IHDR'
|
const pngImageHeaderChunkName = 'IHDR'
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { IImage, ISize } from './interface'
|
import type { IImage, ISize } from './interface.js'
|
||||||
|
|
||||||
const PNMTypes: { [signature: string]: string } = {
|
const PNMTypes: { [signature: string]: string } = {
|
||||||
P1: 'pbm/ascii',
|
P1: 'pbm/ascii',
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { IImage } from './interface'
|
import type { IImage } from './interface.js'
|
||||||
|
|
||||||
export const PSD: IImage = {
|
export const PSD: IImage = {
|
||||||
validate(buffer) {
|
validate(buffer) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { IImage, ISize } from './interface'
|
import type { IImage, ISize } from './interface.js'
|
||||||
|
|
||||||
interface IAttributes {
|
interface IAttributes {
|
||||||
width: number | null
|
width: number | null
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
// TO-DO: support big-endian as well
|
// TO-DO: support big-endian as well
|
||||||
import * as fs from 'node:fs'
|
import * as fs from 'node:fs'
|
||||||
import { readUInt } from '../readUInt.js'
|
import { readUInt } from '../readUInt.js'
|
||||||
import type { IImage } from './interface'
|
import type { IImage } from './interface.js'
|
||||||
|
|
||||||
// Read IFD (image-file-directory) into a buffer
|
// Read IFD (image-file-directory) into a buffer
|
||||||
function readIFD(buffer: Buffer, filepath: string, isBigEndian: boolean) {
|
function readIFD(buffer: Buffer, filepath: string, isBigEndian: boolean) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
// based on https://developers.google.com/speed/webp/docs/riff_container
|
// based on https://developers.google.com/speed/webp/docs/riff_container
|
||||||
import type { IImage, ISize } from './interface'
|
import type { IImage, ISize } from './interface.js'
|
||||||
|
|
||||||
function calculateExtended(buffer: Buffer): ISize {
|
function calculateExtended(buffer: Buffer): ISize {
|
||||||
return {
|
return {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
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, ImageTransform } from '../@types/astro';
|
import type { AstroPluginOptions, ImageTransform } from '../@types/astro.js';
|
||||||
import {
|
import {
|
||||||
appendForwardSlash,
|
appendForwardSlash,
|
||||||
joinPaths,
|
joinPaths,
|
||||||
|
|
|
@ -3,13 +3,11 @@ import parser from '@babel/parser';
|
||||||
import traverse from '@babel/traverse';
|
import traverse from '@babel/traverse';
|
||||||
import * as t from '@babel/types';
|
import * as t from '@babel/types';
|
||||||
|
|
||||||
// @ts-expect-error @babel/traverse isn't ESM and needs this trick
|
export const visit = traverse.default;
|
||||||
export const visit = traverse.default as typeof traverse;
|
|
||||||
export { t };
|
export { t };
|
||||||
|
|
||||||
export async function generate(ast: t.File) {
|
export async function generate(ast: t.File) {
|
||||||
// @ts-expect-error @babel/generator isn't ESM and needs this trick
|
const astToText = generator.default;
|
||||||
const astToText = generator.default as typeof generator;
|
|
||||||
const { code } = astToText(ast);
|
const { code } = astToText(ast);
|
||||||
return code;
|
return code;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { UserConfig } from 'vite';
|
import type { UserConfig } from 'vite';
|
||||||
import type { AstroUserConfig } from '../@types/astro';
|
import type { AstroUserConfig } from '../@types/astro.js';
|
||||||
import { Logger } from '../core/logger/core.js';
|
import { Logger } from '../core/logger/core.js';
|
||||||
|
|
||||||
export function defineConfig(config: AstroUserConfig) {
|
export function defineConfig(config: AstroUserConfig) {
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
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';
|
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';
|
||||||
|
|
||||||
|
|
|
@ -7,7 +7,7 @@ import { normalizePath, type ViteDevServer } from 'vite';
|
||||||
import type { AstroSettings, ContentEntryType } from '../@types/astro.js';
|
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';
|
import type { Logger } from '../core/logger/core.js';
|
||||||
import { isRelativePath } from '../core/path.js';
|
import { isRelativePath } from '../core/path.js';
|
||||||
import { CONTENT_TYPES_FILE, VIRTUAL_MODULE_ID } from './consts.js';
|
import { CONTENT_TYPES_FILE, VIRTUAL_MODULE_ID } from './consts.js';
|
||||||
import {
|
import {
|
||||||
|
|
|
@ -5,7 +5,7 @@ import type { AstroSettings } from '../@types/astro.js';
|
||||||
import { moduleIsTopLevelPage, walkParentInfos } from '../core/build/graph.js';
|
import { moduleIsTopLevelPage, walkParentInfos } from '../core/build/graph.js';
|
||||||
import { getPageDataByViteID, type BuildInternals } from '../core/build/internal.js';
|
import { getPageDataByViteID, type BuildInternals } from '../core/build/internal.js';
|
||||||
import type { AstroBuildPlugin } from '../core/build/plugin.js';
|
import type { AstroBuildPlugin } from '../core/build/plugin.js';
|
||||||
import type { StaticBuildOptions } from '../core/build/types';
|
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';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { deserializeRouteData } from '../routing/manifest/serialization.js';
|
import { deserializeRouteData } from '../routing/manifest/serialization.js';
|
||||||
import type { RouteInfo, SerializedSSRManifest, SSRManifest } from './types';
|
import type { RouteInfo, SerializedSSRManifest, SSRManifest } from './types.js';
|
||||||
|
|
||||||
export function deserializeManifest(serializedManifest: SerializedSSRManifest): SSRManifest {
|
export function deserializeManifest(serializedManifest: SerializedSSRManifest): SSRManifest {
|
||||||
const routes: RouteInfo[] = [];
|
const routes: RouteInfo[] = [];
|
||||||
|
|
|
@ -5,8 +5,8 @@ import type {
|
||||||
RouteData,
|
RouteData,
|
||||||
SSRElement,
|
SSRElement,
|
||||||
SSRManifest,
|
SSRManifest,
|
||||||
} from '../../@types/astro';
|
} from '../../@types/astro.js';
|
||||||
import type { SinglePageBuiltModule } from '../build/types';
|
import type { SinglePageBuiltModule } from '../build/types.js';
|
||||||
import { getSetCookiesFromResponse } from '../cookies/index.js';
|
import { getSetCookiesFromResponse } from '../cookies/index.js';
|
||||||
import { consoleLogDestination } from '../logger/console.js';
|
import { consoleLogDestination } from '../logger/console.js';
|
||||||
import { AstroIntegrationLogger, Logger } from '../logger/core.js';
|
import { AstroIntegrationLogger, Logger } from '../logger/core.js';
|
||||||
|
@ -25,7 +25,7 @@ import {
|
||||||
} from '../render/ssr-element.js';
|
} from '../render/ssr-element.js';
|
||||||
import { matchRoute } from '../routing/match.js';
|
import { matchRoute } from '../routing/match.js';
|
||||||
import { EndpointNotFoundError, SSRRoutePipeline } from './ssrPipeline.js';
|
import { EndpointNotFoundError, SSRRoutePipeline } from './ssrPipeline.js';
|
||||||
import type { RouteInfo } from './types';
|
import type { RouteInfo } from './types.js';
|
||||||
export { deserializeManifest } from './common.js';
|
export { deserializeManifest } from './common.js';
|
||||||
|
|
||||||
const clientLocalsSymbol = Symbol.for('astro.locals');
|
const clientLocalsSymbol = Symbol.for('astro.locals');
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { RouteData } from '../../@types/astro';
|
import type { RouteData } from '../../@types/astro.js';
|
||||||
import type { SerializedSSRManifest, SSRManifest } from './types';
|
import type { SerializedSSRManifest, SSRManifest } from './types.js';
|
||||||
|
|
||||||
import * as fs from 'node:fs';
|
import * as fs from 'node:fs';
|
||||||
import { IncomingMessage } from 'node:http';
|
import { IncomingMessage } from 'node:http';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import { Pipeline } from '../pipeline.js';
|
import { Pipeline } from '../pipeline.js';
|
||||||
import type { Environment } from '../render';
|
import type { Environment } from '../render/index.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Thrown when an endpoint contains a response with the header "X-Astro-Response" === 'Not-Found'
|
* Thrown when an endpoint contains a response with the header "X-Astro-Response" === 'Not-Found'
|
||||||
|
|
|
@ -4,8 +4,8 @@ import type {
|
||||||
SSRComponentMetadata,
|
SSRComponentMetadata,
|
||||||
SSRLoadedRenderer,
|
SSRLoadedRenderer,
|
||||||
SSRResult,
|
SSRResult,
|
||||||
} from '../../@types/astro';
|
} from '../../@types/astro.js';
|
||||||
import type { SinglePageBuiltModule } from '../build/types';
|
import type { SinglePageBuiltModule } from '../build/types.js';
|
||||||
|
|
||||||
export type ComponentPath = string;
|
export type ComponentPath = string;
|
||||||
|
|
||||||
|
|
|
@ -1,16 +1,16 @@
|
||||||
import type { AstroConfig, AstroSettings, SSRLoadedRenderer } from '../../@types/astro';
|
import type { AstroConfig, AstroSettings, SSRLoadedRenderer } from '../../@types/astro.js';
|
||||||
import { getOutputDirectory, isServerLikeOutput } from '../../prerender/utils.js';
|
import { getOutputDirectory, isServerLikeOutput } from '../../prerender/utils.js';
|
||||||
import { BEFORE_HYDRATION_SCRIPT_ID } from '../../vite-plugin-scripts/index.js';
|
import { BEFORE_HYDRATION_SCRIPT_ID } from '../../vite-plugin-scripts/index.js';
|
||||||
import type { SSRManifest } from '../app/types';
|
import type { SSRManifest } from '../app/types.js';
|
||||||
import { Logger } from '../logger/core.js';
|
import { Logger } from '../logger/core.js';
|
||||||
import { Pipeline } from '../pipeline.js';
|
import { Pipeline } from '../pipeline.js';
|
||||||
import { createEnvironment } from '../render/index.js';
|
import { createEnvironment } from '../render/index.js';
|
||||||
import { createAssetLink } from '../render/ssr-element.js';
|
import { createAssetLink } from '../render/ssr-element.js';
|
||||||
import type { BuildInternals } from './internal';
|
import type { BuildInternals } from './internal.js';
|
||||||
import { ASTRO_PAGE_RESOLVED_MODULE_ID } from './plugins/plugin-pages.js';
|
import { ASTRO_PAGE_RESOLVED_MODULE_ID } from './plugins/plugin-pages.js';
|
||||||
import { RESOLVED_SPLIT_MODULE_ID } from './plugins/plugin-ssr.js';
|
import { RESOLVED_SPLIT_MODULE_ID } from './plugins/plugin-ssr.js';
|
||||||
import { ASTRO_PAGE_EXTENSION_POST_PATTERN } from './plugins/util.js';
|
import { ASTRO_PAGE_EXTENSION_POST_PATTERN } from './plugins/util.js';
|
||||||
import type { PageBuildData, StaticBuildOptions } from './types';
|
import type { PageBuildData, StaticBuildOptions } from './types.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This pipeline is responsible to gather the files emitted by the SSR build and generate the pages by executing these files.
|
* This pipeline is responsible to gather the files emitted by the SSR build and generate the pages by executing these files.
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
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, RouteType } from '../../@types/astro';
|
import type { AstroConfig, RouteType } from '../../@types/astro.js';
|
||||||
import { appendForwardSlash } from '../../core/path.js';
|
import { appendForwardSlash } from '../../core/path.js';
|
||||||
|
|
||||||
const STATUS_CODE_PAGES = new Set(['/404', '/500']);
|
const STATUS_CODE_PAGES = new Set(['/404', '/500']);
|
||||||
|
|
|
@ -2,7 +2,7 @@ import type { GetModuleInfo } from 'rollup';
|
||||||
|
|
||||||
import crypto from 'node:crypto';
|
import crypto from 'node:crypto';
|
||||||
import npath from 'node:path';
|
import npath from 'node:path';
|
||||||
import type { AstroSettings } from '../../@types/astro';
|
import type { AstroSettings } from '../../@types/astro.js';
|
||||||
import { viteID } from '../util.js';
|
import { viteID } from '../util.js';
|
||||||
import { getTopLevelPages } from './graph.js';
|
import { getTopLevelPages } from './graph.js';
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ import type {
|
||||||
SSRError,
|
SSRError,
|
||||||
SSRLoadedRenderer,
|
SSRLoadedRenderer,
|
||||||
SSRManifest,
|
SSRManifest,
|
||||||
} from '../../@types/astro';
|
} from '../../@types/astro.js';
|
||||||
import {
|
import {
|
||||||
generateImage as generateImageInternal,
|
generateImage as generateImageInternal,
|
||||||
getStaticImageList,
|
getStaticImageList,
|
||||||
|
@ -57,7 +57,7 @@ import type {
|
||||||
SinglePageBuiltModule,
|
SinglePageBuiltModule,
|
||||||
StaticBuildOptions,
|
StaticBuildOptions,
|
||||||
StylesheetAsset,
|
StylesheetAsset,
|
||||||
} from './types';
|
} from './types.js';
|
||||||
import { getTimeStat } from './util.js';
|
import { getTimeStat } from './util.js';
|
||||||
|
|
||||||
function createEntryURL(filePath: string, outFolder: URL) {
|
function createEntryURL(filePath: string, outFolder: URL) {
|
||||||
|
|
|
@ -9,7 +9,7 @@ import type {
|
||||||
AstroSettings,
|
AstroSettings,
|
||||||
ManifestData,
|
ManifestData,
|
||||||
RuntimeMode,
|
RuntimeMode,
|
||||||
} from '../../@types/astro';
|
} from '../../@types/astro.js';
|
||||||
import { injectImageEndpoint } from '../../assets/internal.js';
|
import { injectImageEndpoint } from '../../assets/internal.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';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import type { Rollup } from 'vite';
|
import type { Rollup } from 'vite';
|
||||||
import type { RouteData, SSRResult } from '../../@types/astro';
|
import type { RouteData, SSRResult } from '../../@types/astro.js';
|
||||||
import type { PageOptions } from '../../vite-plugin-astro/types';
|
import type { PageOptions } from '../../vite-plugin-astro/types.js';
|
||||||
import { prependForwardSlash, removeFileExtension } from '../path.js';
|
import { prependForwardSlash, removeFileExtension } from '../path.js';
|
||||||
import { viteID } from '../util.js';
|
import { viteID } from '../util.js';
|
||||||
import {
|
import {
|
||||||
|
@ -9,7 +9,7 @@ import {
|
||||||
} from './plugins/plugin-pages.js';
|
} from './plugins/plugin-pages.js';
|
||||||
import { RESOLVED_SPLIT_MODULE_ID } from './plugins/plugin-ssr.js';
|
import { RESOLVED_SPLIT_MODULE_ID } from './plugins/plugin-ssr.js';
|
||||||
import { ASTRO_PAGE_EXTENSION_POST_PATTERN } from './plugins/util.js';
|
import { ASTRO_PAGE_EXTENSION_POST_PATTERN } from './plugins/util.js';
|
||||||
import type { PageBuildData, StylesheetAsset, ViteID } from './types';
|
import type { PageBuildData, StylesheetAsset, ViteID } from './types.js';
|
||||||
|
|
||||||
export interface BuildInternals {
|
export interface BuildInternals {
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import type { AstroSettings, ManifestData } from '../../@types/astro';
|
import type { AstroSettings, ManifestData } from '../../@types/astro.js';
|
||||||
import type { Logger } from '../logger/core';
|
import type { Logger } from '../logger/core.js';
|
||||||
import type { AllPagesData } from './types';
|
import type { AllPagesData } from './types.js';
|
||||||
|
|
||||||
import * as colors from 'kleur/colors';
|
import * as colors from 'kleur/colors';
|
||||||
import { debug } from '../logger/core.js';
|
import { debug } from '../logger/core.js';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import type { Plugin as VitePlugin } from 'vite';
|
import type { Plugin as VitePlugin } from 'vite';
|
||||||
import type { BuildInternals } from './internal';
|
import type { BuildInternals } from './internal.js';
|
||||||
import type { StaticBuildOptions, ViteBuildReturn } from './types';
|
import type { StaticBuildOptions, ViteBuildReturn } from './types.js';
|
||||||
|
|
||||||
type RollupOutputArray = Extract<ViteBuildReturn, Array<any>>;
|
type RollupOutputArray = Extract<ViteBuildReturn, Array<any>>;
|
||||||
type OutputChunkorAsset = RollupOutputArray[number]['output'][number];
|
type OutputChunkorAsset = RollupOutputArray[number]['output'][number];
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import { astroConfigBuildPlugin } from '../../../content/vite-plugin-content-assets.js';
|
import { astroConfigBuildPlugin } from '../../../content/vite-plugin-content-assets.js';
|
||||||
import { astroHeadBuildPlugin } from '../../../vite-plugin-head/index.js';
|
import { astroHeadBuildPlugin } from '../../../vite-plugin-head/index.js';
|
||||||
import type { AstroBuildPluginContainer } from '../plugin';
|
import type { AstroBuildPluginContainer } from '../plugin.js';
|
||||||
import { pluginAliasResolve } from './plugin-alias-resolve.js';
|
import { pluginAliasResolve } from './plugin-alias-resolve.js';
|
||||||
import { pluginAnalyzer } from './plugin-analyzer.js';
|
import { pluginAnalyzer } from './plugin-analyzer.js';
|
||||||
import { pluginComponentEntry } from './plugin-component-entry.js';
|
import { pluginComponentEntry } from './plugin-component-entry.js';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import type { ModuleInfo, PluginContext } from 'rollup';
|
import type { ModuleInfo, PluginContext } from 'rollup';
|
||||||
import type { Plugin as VitePlugin } from 'vite';
|
import type { Plugin as VitePlugin } from 'vite';
|
||||||
import type { PluginMetadata as AstroPluginMetadata } from '../../../vite-plugin-astro/types';
|
import type { PluginMetadata as AstroPluginMetadata } from '../../../vite-plugin-astro/types.js';
|
||||||
import type { BuildInternals } from '../internal.js';
|
import type { BuildInternals } from '../internal.js';
|
||||||
import type { AstroBuildPlugin } from '../plugin.js';
|
import type { AstroBuildPlugin } from '../plugin.js';
|
||||||
|
|
||||||
|
|
|
@ -3,9 +3,9 @@ import * as npath from 'node:path';
|
||||||
import type { GetModuleInfo } from 'rollup';
|
import type { GetModuleInfo } from 'rollup';
|
||||||
import { type ResolvedConfig, type Plugin as VitePlugin } from 'vite';
|
import { type ResolvedConfig, type Plugin as VitePlugin } from 'vite';
|
||||||
import { isBuildableCSSRequest } from '../../../vite-plugin-astro-server/util.js';
|
import { isBuildableCSSRequest } from '../../../vite-plugin-astro-server/util.js';
|
||||||
import type { BuildInternals } from '../internal';
|
import type { BuildInternals } from '../internal.js';
|
||||||
import type { AstroBuildPlugin } from '../plugin';
|
import type { AstroBuildPlugin } from '../plugin.js';
|
||||||
import type { PageBuildData, StaticBuildOptions, StylesheetAsset } from '../types';
|
import type { PageBuildData, StaticBuildOptions, StylesheetAsset } from '../types.js';
|
||||||
|
|
||||||
import { PROPAGATED_ASSET_FLAG } from '../../../content/consts.js';
|
import { PROPAGATED_ASSET_FLAG } from '../../../content/consts.js';
|
||||||
import * as assetName from '../css-asset-name.js';
|
import * as assetName from '../css-asset-name.js';
|
||||||
|
|
|
@ -1,10 +1,10 @@
|
||||||
import type { Plugin as VitePlugin } from 'vite';
|
import type { Plugin as VitePlugin } from 'vite';
|
||||||
import type { AstroSettings } from '../../../@types/astro';
|
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';
|
||||||
import type { AstroBuildPlugin } from '../plugin';
|
import type { AstroBuildPlugin } from '../plugin.js';
|
||||||
import type { OutputChunk, StaticBuildOptions } from '../types';
|
import type { OutputChunk, StaticBuildOptions } from '../types.js';
|
||||||
|
|
||||||
function virtualHoistedEntry(id: string) {
|
function virtualHoistedEntry(id: string) {
|
||||||
return id.startsWith('/astro/hoisted.js?q=');
|
return id.startsWith('/astro/hoisted.js?q=');
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import type { Plugin as VitePlugin } from 'vite';
|
import type { Plugin as VitePlugin } from 'vite';
|
||||||
import type { BuildInternals } from '../internal.js';
|
import type { BuildInternals } from '../internal.js';
|
||||||
import type { AstroBuildPlugin } from '../plugin';
|
import type { AstroBuildPlugin } from '../plugin.js';
|
||||||
import { normalizeEntryId } from './plugin-component-entry.js';
|
import { normalizeEntryId } from './plugin-component-entry.js';
|
||||||
|
|
||||||
export function vitePluginInternals(input: Set<string>, internals: BuildInternals): VitePlugin {
|
export function vitePluginInternals(input: Set<string>, internals: BuildInternals): VitePlugin {
|
||||||
|
|
|
@ -4,14 +4,14 @@ import type { OutputChunk } from 'rollup';
|
||||||
import { type Plugin as VitePlugin } from 'vite';
|
import { type Plugin as VitePlugin } from 'vite';
|
||||||
import { runHookBuildSsr } from '../../../integrations/index.js';
|
import { runHookBuildSsr } from '../../../integrations/index.js';
|
||||||
import { BEFORE_HYDRATION_SCRIPT_ID, PAGE_SCRIPT_ID } from '../../../vite-plugin-scripts/index.js';
|
import { BEFORE_HYDRATION_SCRIPT_ID, PAGE_SCRIPT_ID } from '../../../vite-plugin-scripts/index.js';
|
||||||
import type { SerializedRouteInfo, SerializedSSRManifest } from '../../app/types';
|
import type { SerializedRouteInfo, SerializedSSRManifest } from '../../app/types.js';
|
||||||
import { joinPaths, prependForwardSlash } from '../../path.js';
|
import { joinPaths, prependForwardSlash } from '../../path.js';
|
||||||
import { serializeRouteData } from '../../routing/index.js';
|
import { serializeRouteData } from '../../routing/index.js';
|
||||||
import { addRollupInput } from '../add-rollup-input.js';
|
import { addRollupInput } from '../add-rollup-input.js';
|
||||||
import { getOutFile, getOutFolder } from '../common.js';
|
import { getOutFile, getOutFolder } from '../common.js';
|
||||||
import { cssOrder, mergeInlineCss, type BuildInternals } from '../internal.js';
|
import { cssOrder, mergeInlineCss, type BuildInternals } from '../internal.js';
|
||||||
import type { AstroBuildPlugin } from '../plugin';
|
import type { AstroBuildPlugin } from '../plugin.js';
|
||||||
import type { StaticBuildOptions } from '../types';
|
import type { StaticBuildOptions } from '../types.js';
|
||||||
|
|
||||||
const manifestReplace = '@@ASTRO_MANIFEST_REPLACE@@';
|
const manifestReplace = '@@ASTRO_MANIFEST_REPLACE@@';
|
||||||
const replaceExp = new RegExp(`['"](${manifestReplace})['"]`, 'g');
|
const replaceExp = new RegExp(`['"](${manifestReplace})['"]`, 'g');
|
||||||
|
@ -46,8 +46,8 @@ function vitePluginManifest(options: StaticBuildOptions, internals: BuildInterna
|
||||||
`import { _privateSetManifestDontUseThis } from 'astro:ssr-manifest'`
|
`import { _privateSetManifestDontUseThis } from 'astro:ssr-manifest'`
|
||||||
);
|
);
|
||||||
|
|
||||||
contents.push(`
|
contents.push(`
|
||||||
const manifest = _deserializeManifest('${manifestReplace}');
|
const manifest = _deserializeManifest('${manifestReplace}');
|
||||||
_privateSetManifestDontUseThis(manifest);
|
_privateSetManifestDontUseThis(manifest);
|
||||||
`);
|
`);
|
||||||
|
|
||||||
|
|
|
@ -2,9 +2,9 @@ import type { Plugin as VitePlugin } from 'vite';
|
||||||
import { getOutputDirectory } from '../../../prerender/utils.js';
|
import { getOutputDirectory } from '../../../prerender/utils.js';
|
||||||
import { MIDDLEWARE_PATH_SEGMENT_NAME } from '../../constants.js';
|
import { MIDDLEWARE_PATH_SEGMENT_NAME } from '../../constants.js';
|
||||||
import { addRollupInput } from '../add-rollup-input.js';
|
import { addRollupInput } from '../add-rollup-input.js';
|
||||||
import type { BuildInternals } from '../internal';
|
import type { BuildInternals } from '../internal.js';
|
||||||
import type { AstroBuildPlugin } from '../plugin';
|
import type { AstroBuildPlugin } from '../plugin.js';
|
||||||
import type { StaticBuildOptions } from '../types';
|
import type { StaticBuildOptions } from '../types.js';
|
||||||
|
|
||||||
export const MIDDLEWARE_MODULE_ID = '@astro-middleware';
|
export const MIDDLEWARE_MODULE_ID = '@astro-middleware';
|
||||||
|
|
||||||
|
|
|
@ -1,11 +1,11 @@
|
||||||
import { extname } from 'node:path';
|
import { extname } from 'node:path';
|
||||||
import type { Plugin as VitePlugin } from 'vite';
|
import type { Plugin as VitePlugin } from 'vite';
|
||||||
import type { AstroSettings } from '../../../@types/astro';
|
import type { AstroSettings } from '../../../@types/astro.js';
|
||||||
import { routeIsRedirect } from '../../redirects/index.js';
|
import { routeIsRedirect } from '../../redirects/index.js';
|
||||||
import { addRollupInput } from '../add-rollup-input.js';
|
import { addRollupInput } from '../add-rollup-input.js';
|
||||||
import { type BuildInternals } from '../internal.js';
|
import { type BuildInternals } from '../internal.js';
|
||||||
import type { AstroBuildPlugin } from '../plugin';
|
import type { AstroBuildPlugin } from '../plugin.js';
|
||||||
import type { StaticBuildOptions } from '../types';
|
import type { StaticBuildOptions } from '../types.js';
|
||||||
import { MIDDLEWARE_MODULE_ID } from './plugin-middleware.js';
|
import { MIDDLEWARE_MODULE_ID } from './plugin-middleware.js';
|
||||||
import { RENDERERS_MODULE_ID } from './plugin-renderers.js';
|
import { RENDERERS_MODULE_ID } from './plugin-renderers.js';
|
||||||
import { ASTRO_PAGE_EXTENSION_POST_PATTERN, getPathFromVirtualModulePageName } from './util.js';
|
import { ASTRO_PAGE_EXTENSION_POST_PATTERN, getPathFromVirtualModulePageName } from './util.js';
|
||||||
|
|
|
@ -3,7 +3,7 @@ import type { Plugin as VitePlugin } from 'vite';
|
||||||
import { getPrerenderMetadata } from '../../../prerender/metadata.js';
|
import { getPrerenderMetadata } from '../../../prerender/metadata.js';
|
||||||
import type { BuildInternals } from '../internal.js';
|
import type { BuildInternals } from '../internal.js';
|
||||||
import type { AstroBuildPlugin } from '../plugin.js';
|
import type { AstroBuildPlugin } from '../plugin.js';
|
||||||
import type { StaticBuildOptions } from '../types';
|
import type { StaticBuildOptions } from '../types.js';
|
||||||
import { extendManualChunks } from './util.js';
|
import { extendManualChunks } from './util.js';
|
||||||
|
|
||||||
function vitePluginPrerender(opts: StaticBuildOptions, internals: BuildInternals): VitePlugin {
|
function vitePluginPrerender(opts: StaticBuildOptions, internals: BuildInternals): VitePlugin {
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import type { Plugin as VitePlugin } from 'vite';
|
import type { Plugin as VitePlugin } from 'vite';
|
||||||
import { addRollupInput } from '../add-rollup-input.js';
|
import { addRollupInput } from '../add-rollup-input.js';
|
||||||
import type { AstroBuildPlugin } from '../plugin';
|
import type { AstroBuildPlugin } from '../plugin.js';
|
||||||
import type { StaticBuildOptions } from '../types';
|
import type { StaticBuildOptions } from '../types.js';
|
||||||
|
|
||||||
export const RENDERERS_MODULE_ID = '@astro-renderers';
|
export const RENDERERS_MODULE_ID = '@astro-renderers';
|
||||||
export const RESOLVED_RENDERERS_MODULE_ID = `\0${RENDERERS_MODULE_ID}`;
|
export const RESOLVED_RENDERERS_MODULE_ID = `\0${RENDERERS_MODULE_ID}`;
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
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, AstroConfig } from '../../../@types/astro';
|
import type { AstroAdapter, AstroConfig } from '../../../@types/astro.js';
|
||||||
import { isFunctionPerRouteEnabled } from '../../../integrations/index.js';
|
import { isFunctionPerRouteEnabled } from '../../../integrations/index.js';
|
||||||
import { isServerLikeOutput } from '../../../prerender/utils.js';
|
import { isServerLikeOutput } from '../../../prerender/utils.js';
|
||||||
import { routeIsRedirect } from '../../redirects/index.js';
|
import { routeIsRedirect } from '../../redirects/index.js';
|
||||||
import { addRollupInput } from '../add-rollup-input.js';
|
import { addRollupInput } from '../add-rollup-input.js';
|
||||||
import type { BuildInternals } from '../internal.js';
|
import type { BuildInternals } from '../internal.js';
|
||||||
import type { AstroBuildPlugin } from '../plugin';
|
import type { AstroBuildPlugin } from '../plugin.js';
|
||||||
import type { StaticBuildOptions } from '../types';
|
import type { StaticBuildOptions } from '../types.js';
|
||||||
import { SSR_MANIFEST_VIRTUAL_MODULE_ID } from './plugin-manifest.js';
|
import { SSR_MANIFEST_VIRTUAL_MODULE_ID } from './plugin-manifest.js';
|
||||||
import { ASTRO_PAGE_MODULE_ID } from './plugin-pages.js';
|
import { ASTRO_PAGE_MODULE_ID } from './plugin-pages.js';
|
||||||
import { RENDERERS_MODULE_ID } from './plugin-renderers.js';
|
import { RENDERERS_MODULE_ID } from './plugin-renderers.js';
|
||||||
|
@ -246,8 +246,8 @@ function generateSSRCode(config: AstroConfig, adapter: AstroAdapter) {
|
||||||
}
|
}
|
||||||
|
|
||||||
contents.push(`import * as adapter from '${adapter.serverEntrypoint}';
|
contents.push(`import * as adapter from '${adapter.serverEntrypoint}';
|
||||||
import { renderers } from '${RENDERERS_MODULE_ID}';
|
import { renderers } from '${RENDERERS_MODULE_ID}';
|
||||||
import { manifest as defaultManifest} from '${SSR_MANIFEST_VIRTUAL_MODULE_ID}';
|
import { manifest as defaultManifest} from '${SSR_MANIFEST_VIRTUAL_MODULE_ID}';
|
||||||
const _manifest = Object.assign(defaultManifest, {
|
const _manifest = Object.assign(defaultManifest, {
|
||||||
${pageMap},
|
${pageMap},
|
||||||
renderers,
|
renderers,
|
||||||
|
|
|
@ -6,7 +6,7 @@ import fs from 'node:fs';
|
||||||
import path, { extname } from 'node:path';
|
import path, { extname } from 'node:path';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
import * as vite from 'vite';
|
import * as vite from 'vite';
|
||||||
import type { RouteData } from '../../@types/astro';
|
import type { RouteData } from '../../@types/astro.js';
|
||||||
import {
|
import {
|
||||||
createBuildInternals,
|
createBuildInternals,
|
||||||
eachPageData,
|
eachPageData,
|
||||||
|
@ -30,7 +30,7 @@ import { ASTRO_PAGE_RESOLVED_MODULE_ID } from './plugins/plugin-pages.js';
|
||||||
import { RESOLVED_RENDERERS_MODULE_ID } from './plugins/plugin-renderers.js';
|
import { RESOLVED_RENDERERS_MODULE_ID } from './plugins/plugin-renderers.js';
|
||||||
import { RESOLVED_SPLIT_MODULE_ID, RESOLVED_SSR_VIRTUAL_MODULE_ID } from './plugins/plugin-ssr.js';
|
import { RESOLVED_SPLIT_MODULE_ID, RESOLVED_SSR_VIRTUAL_MODULE_ID } from './plugins/plugin-ssr.js';
|
||||||
import { ASTRO_PAGE_EXTENSION_POST_PATTERN } from './plugins/util.js';
|
import { ASTRO_PAGE_EXTENSION_POST_PATTERN } from './plugins/util.js';
|
||||||
import type { PageBuildData, StaticBuildOptions } from './types';
|
import type { PageBuildData, StaticBuildOptions } from './types.js';
|
||||||
import { getTimeStat } from './util.js';
|
import { getTimeStat } from './util.js';
|
||||||
|
|
||||||
export async function viteBuild(opts: StaticBuildOptions) {
|
export async function viteBuild(opts: StaticBuildOptions) {
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import type { InlineConfig, default as vite } from 'vite';
|
import type * as vite from 'vite';
|
||||||
|
import type { InlineConfig } from 'vite';
|
||||||
import type {
|
import type {
|
||||||
AstroConfig,
|
AstroConfig,
|
||||||
AstroSettings,
|
AstroSettings,
|
||||||
|
@ -8,9 +9,9 @@ import type {
|
||||||
RouteData,
|
RouteData,
|
||||||
RuntimeMode,
|
RuntimeMode,
|
||||||
SSRLoadedRenderer,
|
SSRLoadedRenderer,
|
||||||
} from '../../@types/astro';
|
} from '../../@types/astro.js';
|
||||||
import type { Logger } from '../logger/core';
|
import type { Logger } from '../logger/core.js';
|
||||||
import type { RouteCache } from '../render/route-cache';
|
import type { RouteCache } from '../render/route-cache.js';
|
||||||
|
|
||||||
export type ComponentPath = string;
|
export type ComponentPath = string;
|
||||||
export type ViteID = string;
|
export type ViteID = string;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { AstroConfig } from '../../@types/astro';
|
import type { AstroConfig } from '../../@types/astro.js';
|
||||||
import { compile, type CompileProps, type CompileResult } from './compile.js';
|
import { compile, type CompileProps, type CompileResult } from './compile.js';
|
||||||
|
|
||||||
type CompilationCache = Map<string, CompileResult>;
|
type CompilationCache = Map<string, CompileResult>;
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
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';
|
import type { AstroConfig } from '../../@types/astro.js';
|
||||||
|
|
||||||
import { transform } from '@astrojs/compiler';
|
import { transform } from '@astrojs/compiler';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
|
|
|
@ -4,5 +4,5 @@ export {
|
||||||
invalidateCompilation,
|
invalidateCompilation,
|
||||||
isCached,
|
isCached,
|
||||||
} from './cache.js';
|
} from './cache.js';
|
||||||
export type { CompileProps, CompileResult } from './compile';
|
export type { CompileProps, CompileResult } from './compile.js';
|
||||||
export type { TransformStyle } from './types';
|
export type { TransformStyle } from './types.js';
|
||||||
|
|
|
@ -5,7 +5,7 @@ import type {
|
||||||
AstroInlineOnlyConfig,
|
AstroInlineOnlyConfig,
|
||||||
AstroUserConfig,
|
AstroUserConfig,
|
||||||
CLIFlags,
|
CLIFlags,
|
||||||
} from '../../@types/astro';
|
} from '../../@types/astro.js';
|
||||||
|
|
||||||
import * as colors from 'kleur/colors';
|
import * as colors from 'kleur/colors';
|
||||||
import fs from 'node:fs';
|
import fs from 'node:fs';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
export { resolveConfig, resolveConfigPath, resolveFlags, resolveRoot } from './config.js';
|
export { resolveConfig, resolveConfigPath, resolveFlags, resolveRoot } from './config.js';
|
||||||
export { createNodeLogger } from './logging.js';
|
export { createNodeLogger } from './logging.js';
|
||||||
export { mergeConfig } from './merge.js';
|
export { mergeConfig } from './merge.js';
|
||||||
export type { AstroConfigType } from './schema';
|
export type { AstroConfigType } from './schema.js';
|
||||||
export { createSettings } from './settings.js';
|
export { createSettings } from './settings.js';
|
||||||
export { loadTSConfig, updateTSConfigForFramework } from './tsconfig.js';
|
export { loadTSConfig, updateTSConfigForFramework } from './tsconfig.js';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import type { RehypePlugin, RemarkPlugin, RemarkRehype } from '@astrojs/markdown-remark';
|
import type { RehypePlugin, RemarkPlugin, RemarkRehype } from '@astrojs/markdown-remark';
|
||||||
import { markdownConfigDefaults } from '@astrojs/markdown-remark';
|
import { markdownConfigDefaults } from '@astrojs/markdown-remark';
|
||||||
import type { ILanguageRegistration, IShikiTheme, Theme } from 'shiki';
|
import type { ILanguageRegistration, IShikiTheme, Theme } from 'shiki';
|
||||||
import type { AstroUserConfig, ViteUserConfig } from '../../@types/astro';
|
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';
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import yaml from 'js-yaml';
|
import yaml from 'js-yaml';
|
||||||
import path from 'node:path';
|
import path from 'node:path';
|
||||||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||||
import type { AstroConfig, AstroSettings } from '../../@types/astro';
|
import type { AstroConfig, AstroSettings } from '../../@types/astro.js';
|
||||||
import { getContentPaths } from '../../content/index.js';
|
import { getContentPaths } from '../../content/index.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';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { AstroCookies } from './cookies';
|
import type { AstroCookies } from './cookies.js';
|
||||||
|
|
||||||
const astroCookiesSymbol = Symbol.for('astro.cookies');
|
const astroCookiesSymbol = Symbol.for('astro.cookies');
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { AstroSettings } from '../@types/astro';
|
import type { AstroSettings } from '../@types/astro.js';
|
||||||
import type { Logger } from './logger/core';
|
import type { Logger } from './logger/core.js';
|
||||||
|
|
||||||
import nodeFs from 'node:fs';
|
import nodeFs from 'node:fs';
|
||||||
import { fileURLToPath } from 'node:url';
|
import { fileURLToPath } from 'node:url';
|
||||||
|
@ -168,7 +168,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', import.meta.url)),
|
replacement: fileURLToPath(new URL('../@types/astro.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';
|
import type { AstroInlineConfig, 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';
|
||||||
|
|
|
@ -3,7 +3,7 @@ import type http from 'node:http';
|
||||||
import type { AddressInfo } from 'node:net';
|
import type { AddressInfo } from 'node:net';
|
||||||
import { performance } from 'perf_hooks';
|
import { performance } from 'perf_hooks';
|
||||||
import type * as vite from 'vite';
|
import type * as vite from 'vite';
|
||||||
import type { AstroInlineConfig } from '../../@types/astro';
|
import type { AstroInlineConfig } from '../../@types/astro.js';
|
||||||
import { attachContentServerListeners } from '../../content/index.js';
|
import { attachContentServerListeners } from '../../content/index.js';
|
||||||
import { telemetry } from '../../events/index.js';
|
import { telemetry } from '../../events/index.js';
|
||||||
import * as msg from '../messages.js';
|
import * as msg from '../messages.js';
|
||||||
|
|
|
@ -1,14 +1,14 @@
|
||||||
import nodeFs from 'node:fs';
|
import 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';
|
import type { AstroInlineConfig, AstroSettings } from '../../@types/astro.js';
|
||||||
import { eventCliSession, telemetry } from '../../events/index.js';
|
import { eventCliSession, telemetry } from '../../events/index.js';
|
||||||
import { createNodeLogger, createSettings, resolveConfig } from '../config/index.js';
|
import { 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';
|
||||||
import { createSafeError } from '../errors/index.js';
|
import { createSafeError } from '../errors/index.js';
|
||||||
import { formatErrorMessage } from '../messages.js';
|
import { formatErrorMessage } from '../messages.js';
|
||||||
import type { Container } from './container';
|
import type { Container } from './container.js';
|
||||||
import { createContainer, startContainer } from './container.js';
|
import { createContainer, startContainer } from './container.js';
|
||||||
|
|
||||||
async function createRestartedContainer(
|
async function createRestartedContainer(
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { EndpointHandler } from '../../../@types/astro';
|
import type { EndpointHandler } from '../../../@types/astro.js';
|
||||||
import { createRenderContext, type SSROptions } from '../../render/index.js';
|
import { createRenderContext, type SSROptions } from '../../render/index.js';
|
||||||
import { callEndpoint } from '../index.js';
|
import { callEndpoint } from '../index.js';
|
||||||
|
|
||||||
|
|
|
@ -6,13 +6,13 @@ import type {
|
||||||
MiddlewareEndpointHandler,
|
MiddlewareEndpointHandler,
|
||||||
MiddlewareHandler,
|
MiddlewareHandler,
|
||||||
Params,
|
Params,
|
||||||
} from '../../@types/astro';
|
} from '../../@types/astro.js';
|
||||||
import { renderEndpoint } from '../../runtime/server/index.js';
|
import { renderEndpoint } from '../../runtime/server/index.js';
|
||||||
import { ASTRO_VERSION } from '../constants.js';
|
import { ASTRO_VERSION } from '../constants.js';
|
||||||
import { AstroCookies, attachCookiesToResponse } from '../cookies/index.js';
|
import { AstroCookies, attachCookiesToResponse } from '../cookies/index.js';
|
||||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||||
import { callMiddleware } from '../middleware/callMiddleware.js';
|
import { callMiddleware } from '../middleware/callMiddleware.js';
|
||||||
import type { Environment, RenderContext } from '../render/index';
|
import type { Environment, RenderContext } from '../render/index.js';
|
||||||
|
|
||||||
const encoder = new TextEncoder();
|
const encoder = new TextEncoder();
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
export type { ErrorLocation, ErrorWithMetadata } from './errors';
|
|
||||||
export * as AstroErrorData from './errors-data.js';
|
export * as AstroErrorData from './errors-data.js';
|
||||||
export {
|
export {
|
||||||
AggregateError,
|
AggregateError,
|
||||||
|
@ -9,5 +8,6 @@ export {
|
||||||
MarkdownError,
|
MarkdownError,
|
||||||
isAstroError,
|
isAstroError,
|
||||||
} from './errors.js';
|
} from './errors.js';
|
||||||
|
export type { ErrorLocation, ErrorWithMetadata } from './errors.js';
|
||||||
export { codeFrame } from './printer.js';
|
export { codeFrame } from './printer.js';
|
||||||
export { createSafeError, positionAt } from './utils.js';
|
export { createSafeError, positionAt } from './utils.js';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { AstroErrorPayload } from './dev/vite';
|
import type { AstroErrorPayload } from './dev/vite.js';
|
||||||
|
|
||||||
const style = /* css */ `
|
const style = /* css */ `
|
||||||
* {
|
* {
|
||||||
|
|
|
@ -4,9 +4,9 @@ import type {
|
||||||
EndpointOutput,
|
EndpointOutput,
|
||||||
MiddlewareHandler,
|
MiddlewareHandler,
|
||||||
MiddlewareNext,
|
MiddlewareNext,
|
||||||
} from '../../@types/astro';
|
} from '../../@types/astro.js';
|
||||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||||
import type { Environment } from '../render';
|
import type { Environment } from '../render/index.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Utility function that is in charge of calling the middleware.
|
* Utility function that is in charge of calling the middleware.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { MiddlewareResponseHandler, Params } from '../../@types/astro';
|
import type { MiddlewareResponseHandler, Params } from '../../@types/astro.js';
|
||||||
import { createAPIContext } from '../endpoint/index.js';
|
import { createAPIContext } from '../endpoint/index.js';
|
||||||
import { sequence } from './sequence.js';
|
import { sequence } from './sequence.js';
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import type { AstroSettings } from '../../@types/astro';
|
import type { AstroSettings } from '../../@types/astro.js';
|
||||||
import { MIDDLEWARE_PATH_SEGMENT_NAME } from '../constants.js';
|
import { MIDDLEWARE_PATH_SEGMENT_NAME } from '../constants.js';
|
||||||
import type { ModuleLoader } from '../module-loader';
|
import type { ModuleLoader } from '../module-loader/index.js';
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* It accepts a module loader and the astro settings, and it attempts to load the middlewares defined in the configuration.
|
* It accepts a module loader and the astro settings, and it attempts to load the middlewares defined in the configuration.
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { APIContext, MiddlewareResponseHandler } from '../../@types/astro';
|
import type { APIContext, MiddlewareResponseHandler } from '../../@types/astro.js';
|
||||||
import { defineMiddleware } from './index.js';
|
import { defineMiddleware } from './index.js';
|
||||||
|
|
||||||
// From SvelteKit: https://github.com/sveltejs/kit/blob/master/packages/kit/src/exports/hooks/sequence.js
|
// From SvelteKit: https://github.com/sveltejs/kit/blob/master/packages/kit/src/exports/hooks/sequence.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';
|
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,6 +1,6 @@
|
||||||
import { EventEmitter } from 'node:events';
|
import { EventEmitter } from 'node:events';
|
||||||
import type * as vite from 'vite';
|
import type * as vite from 'vite';
|
||||||
import type { ModuleLoader, ModuleLoaderEventEmitter } from './loader';
|
import type { ModuleLoader, ModuleLoaderEventEmitter } from './loader.js';
|
||||||
|
|
||||||
export function createViteLoader(viteServer: vite.ViteDevServer): ModuleLoader {
|
export function createViteLoader(viteServer: vite.ViteDevServer): ModuleLoader {
|
||||||
const events = new EventEmitter() as ModuleLoaderEventEmitter;
|
const events = new EventEmitter() as ModuleLoaderEventEmitter;
|
||||||
|
|
|
@ -4,7 +4,7 @@ import type {
|
||||||
MiddlewareEndpointHandler,
|
MiddlewareEndpointHandler,
|
||||||
MiddlewareHandler,
|
MiddlewareHandler,
|
||||||
MiddlewareResponseHandler,
|
MiddlewareResponseHandler,
|
||||||
} from '../@types/astro';
|
} from '../@types/astro.js';
|
||||||
import { callEndpoint, createAPIContext } from './endpoint/index.js';
|
import { callEndpoint, createAPIContext } from './endpoint/index.js';
|
||||||
import { callMiddleware } from './middleware/callMiddleware.js';
|
import { callMiddleware } from './middleware/callMiddleware.js';
|
||||||
import { renderPage } from './render/core.js';
|
import { renderPage } from './render/core.js';
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
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';
|
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';
|
||||||
|
|
|
@ -3,8 +3,8 @@ import { fileURLToPath } from 'node:url';
|
||||||
import { performance } from 'perf_hooks';
|
import { performance } from 'perf_hooks';
|
||||||
import enableDestroy from 'server-destroy';
|
import enableDestroy from 'server-destroy';
|
||||||
import { preview, type PreviewServer as VitePreviewServer } from 'vite';
|
import { preview, type PreviewServer as VitePreviewServer } from 'vite';
|
||||||
import type { AstroSettings } from '../../@types/astro';
|
import type { AstroSettings } from '../../@types/astro.js';
|
||||||
import type { Logger } from '../logger/core';
|
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';
|
||||||
import { vitePluginAstroPreview } from './vite-plugin-astro-preview.js';
|
import { vitePluginAstroPreview } from './vite-plugin-astro-preview.js';
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { ComponentInstance } from '../../@types/astro';
|
import type { ComponentInstance } from '../../@types/astro.js';
|
||||||
import type { SinglePageBuiltModule } from '../build/types';
|
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
|
||||||
export const RedirectComponentInstance: ComponentInstance = {
|
export const RedirectComponentInstance: ComponentInstance = {
|
||||||
|
|
|
@ -1,4 +1,9 @@
|
||||||
import type { Params, RedirectRouteData, RouteData, ValidRedirectStatus } from '../../@types/astro';
|
import type {
|
||||||
|
Params,
|
||||||
|
RedirectRouteData,
|
||||||
|
RouteData,
|
||||||
|
ValidRedirectStatus,
|
||||||
|
} from '../../@types/astro.js';
|
||||||
|
|
||||||
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';
|
||||||
|
|
|
@ -5,9 +5,9 @@ import type {
|
||||||
RouteData,
|
RouteData,
|
||||||
SSRElement,
|
SSRElement,
|
||||||
SSRResult,
|
SSRResult,
|
||||||
} from '../../@types/astro';
|
} from '../../@types/astro.js';
|
||||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||||
import type { Environment } from './environment';
|
import type { Environment } from './environment.js';
|
||||||
import { getParamsAndProps } from './params-and-props.js';
|
import { getParamsAndProps } from './params-and-props.js';
|
||||||
|
|
||||||
const clientLocalsSymbol = Symbol.for('astro.locals');
|
const clientLocalsSymbol = Symbol.for('astro.locals');
|
||||||
|
|
|
@ -4,7 +4,7 @@ import type {
|
||||||
EndpointHandler,
|
EndpointHandler,
|
||||||
MiddlewareHandler,
|
MiddlewareHandler,
|
||||||
MiddlewareResponseHandler,
|
MiddlewareResponseHandler,
|
||||||
} from '../../@types/astro';
|
} from '../../@types/astro.js';
|
||||||
import { renderPage as runtimeRenderPage } from '../../runtime/server/index.js';
|
import { renderPage as runtimeRenderPage } from '../../runtime/server/index.js';
|
||||||
import { attachCookiesToResponse } from '../cookies/index.js';
|
import { attachCookiesToResponse } from '../cookies/index.js';
|
||||||
import { callEndpoint, createAPIContext } from '../endpoint/index.js';
|
import { callEndpoint, createAPIContext } from '../endpoint/index.js';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { RuntimeMode, SSRLoadedRenderer } from '../../@types/astro';
|
import type { RuntimeMode, SSRLoadedRenderer } from '../../@types/astro.js';
|
||||||
import type { Logger } from '../logger/core.js';
|
import type { Logger } from '../logger/core.js';
|
||||||
import type { RouteCache } from './route-cache.js';
|
import type { RouteCache } from './route-cache.js';
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { AstroMiddlewareInstance, ComponentInstance, RouteData } from '../../@types/astro';
|
import type { AstroMiddlewareInstance, ComponentInstance, RouteData } from '../../@types/astro.js';
|
||||||
import type { Environment } from './environment';
|
import type { Environment } from './environment.js';
|
||||||
export { createRenderContext } from './context.js';
|
export { createRenderContext } from './context.js';
|
||||||
export type { RenderContext } from './context.js';
|
export type { RenderContext } from './context.js';
|
||||||
export { tryRenderRoute } from './core.js';
|
export { tryRenderRoute } from './core.js';
|
||||||
|
|
|
@ -5,7 +5,7 @@ import type {
|
||||||
Params,
|
Params,
|
||||||
Props,
|
Props,
|
||||||
RouteData,
|
RouteData,
|
||||||
} from '../../@types/astro';
|
} from '../../@types/astro.js';
|
||||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||||
|
|
||||||
export function generatePaginateFunction(
|
export function generatePaginateFunction(
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { ComponentInstance, Params, Props, RouteData } from '../../@types/astro';
|
import type { ComponentInstance, Params, Props, RouteData } from '../../@types/astro.js';
|
||||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||||
import type { Logger } from '../logger/core.js';
|
import type { Logger } from '../logger/core.js';
|
||||||
import { getParams } from '../routing/params.js';
|
import { getParams } from '../routing/params.js';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { AstroRenderer, SSRLoadedRenderer } from '../../@types/astro';
|
import type { AstroRenderer, SSRLoadedRenderer } from '../../@types/astro.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(
|
||||||
|
|
|
@ -5,7 +5,7 @@ import type {
|
||||||
SSRElement,
|
SSRElement,
|
||||||
SSRLoadedRenderer,
|
SSRLoadedRenderer,
|
||||||
SSRResult,
|
SSRResult,
|
||||||
} from '../../@types/astro';
|
} from '../../@types/astro.js';
|
||||||
import { renderSlotToString, type ComponentSlots } from '../../runtime/server/index.js';
|
import { renderSlotToString, type ComponentSlots } from '../../runtime/server/index.js';
|
||||||
import { renderJSX } from '../../runtime/server/jsx.js';
|
import { renderJSX } from '../../runtime/server/jsx.js';
|
||||||
import { chunkToString } from '../../runtime/server/render/index.js';
|
import { chunkToString } from '../../runtime/server/render/index.js';
|
||||||
|
|
|
@ -7,7 +7,7 @@ import type {
|
||||||
Params,
|
Params,
|
||||||
RouteData,
|
RouteData,
|
||||||
RuntimeMode,
|
RuntimeMode,
|
||||||
} from '../../@types/astro';
|
} from '../../@types/astro.js';
|
||||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||||
import type { Logger } from '../logger/core.js';
|
import type { Logger } from '../logger/core.js';
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import type { SSRElement } from '../../@types/astro';
|
import type { SSRElement } from '../../@types/astro.js';
|
||||||
import { joinPaths, prependForwardSlash, slash } from '../../core/path.js';
|
import { joinPaths, prependForwardSlash, slash } from '../../core/path.js';
|
||||||
import type { StylesheetAsset } from '../app/types';
|
import type { StylesheetAsset } from '../app/types.js';
|
||||||
|
|
||||||
export function createAssetLink(href: string, base?: string, assetsPrefix?: string): string {
|
export function createAssetLink(href: string, base?: string, assetsPrefix?: string): string {
|
||||||
if (assetsPrefix) {
|
if (assetsPrefix) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
import type { IncomingHttpHeaders } from 'node:http';
|
import type { IncomingHttpHeaders } from 'node:http';
|
||||||
import type { Logger } from './logger/core';
|
import type { Logger } from './logger/core.js';
|
||||||
|
|
||||||
type HeaderType = Headers | Record<string, any> | IncomingHttpHeaders;
|
type HeaderType = Headers | Record<string, any> | IncomingHttpHeaders;
|
||||||
type RequestBody = ArrayBuffer | Blob | ReadableStream | URLSearchParams | FormData;
|
type RequestBody = ArrayBuffer | Blob | ReadableStream | URLSearchParams | FormData;
|
||||||
|
|
|
@ -5,8 +5,8 @@ import type {
|
||||||
ManifestData,
|
ManifestData,
|
||||||
RouteData,
|
RouteData,
|
||||||
RoutePart,
|
RoutePart,
|
||||||
} from '../../../@types/astro';
|
} from '../../../@types/astro.js';
|
||||||
import type { Logger } from '../../logger/core';
|
import type { Logger } from '../../logger/core.js';
|
||||||
|
|
||||||
import { createRequire } from 'module';
|
import { createRequire } from 'module';
|
||||||
import nodeFs from 'node:fs';
|
import nodeFs from 'node:fs';
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { AstroConfig, RoutePart } from '../../../@types/astro';
|
import type { AstroConfig, RoutePart } from '../../../@types/astro.js';
|
||||||
|
|
||||||
import { compile } from 'path-to-regexp';
|
import { compile } from 'path-to-regexp';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { AstroConfig, RouteData, SerializedRouteData } from '../../../@types/astro';
|
import type { AstroConfig, RouteData, SerializedRouteData } from '../../../@types/astro.js';
|
||||||
|
|
||||||
import { getRouteGenerator } from './generator.js';
|
import { getRouteGenerator } from './generator.js';
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { ManifestData, RouteData } from '../../@types/astro';
|
import type { ManifestData, RouteData } from '../../@types/astro.js';
|
||||||
|
|
||||||
/** Find matching route from pathname */
|
/** Find matching route from pathname */
|
||||||
export function matchRoute(pathname: string, manifest: ManifestData): RouteData | undefined {
|
export function matchRoute(pathname: string, manifest: ManifestData): RouteData | undefined {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
import type { GetStaticPathsItem, Params, RouteData } from '../../@types/astro';
|
import type { GetStaticPathsItem, Params, RouteData } from '../../@types/astro.js';
|
||||||
import { trimSlashes } from '../path.js';
|
import { trimSlashes } from '../path.js';
|
||||||
import { validateGetStaticPathsParameter } from './validation.js';
|
import { validateGetStaticPathsParameter } from './validation.js';
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import type { ComponentInstance, GetStaticPathsResult, RouteData } from '../../@types/astro';
|
import type { ComponentInstance, GetStaticPathsResult, RouteData } from '../../@types/astro.js';
|
||||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||||
import type { Logger } from '../logger/core';
|
import type { Logger } from '../logger/core.js';
|
||||||
|
|
||||||
const VALID_PARAM_TYPES = ['string', 'number', 'undefined'];
|
const VALID_PARAM_TYPES = ['string', 'number', 'undefined'];
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue