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",
|
||||
"include": ["src"],
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"module": "ES2022",
|
||||
"outDir": "./dist",
|
||||
"target": "ES2022"
|
||||
"outDir": "./dist"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2,9 +2,6 @@
|
|||
"extends": "../../tsconfig.base.json",
|
||||
"include": ["src"],
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"target": "ES2022",
|
||||
"module": "ES2022",
|
||||
"outDir": "./dist"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import type { z } from 'astro/zod';
|
||||
import type { RSSOptions } from './index';
|
||||
import type { RSSOptions } from './index.js';
|
||||
|
||||
/** Normalize URL to its canonical form */
|
||||
export function createCanonicalURL(
|
||||
|
|
|
@ -2,10 +2,6 @@
|
|||
"extends": "../../tsconfig.base.json",
|
||||
"include": ["src"],
|
||||
"compilerOptions": {
|
||||
"allowJs": true,
|
||||
"module": "ES2022",
|
||||
"outDir": "./dist",
|
||||
"target": "ES2022",
|
||||
"strictNullChecks": true
|
||||
"outDir": "./dist"
|
||||
}
|
||||
}
|
||||
|
|
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').UnresolvedImageTransform
|
||||
) => 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;
|
||||
Image: typeof import('./components/Image.astro').default;
|
||||
};
|
||||
|
@ -126,7 +126,7 @@ declare module '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 {
|
||||
frontmatter: MD['frontmatter'];
|
||||
file: MD['file'];
|
||||
|
@ -231,7 +231,7 @@ declare module '*.mdown' {
|
|||
}
|
||||
|
||||
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 file: MDX['file'];
|
||||
|
@ -244,7 +244,7 @@ declare module '*.mdx' {
|
|||
}
|
||||
|
||||
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`)
|
||||
|
|
|
@ -13,16 +13,16 @@ import type { AddressInfo } from 'node:net';
|
|||
import type * as rollup from 'rollup';
|
||||
import type { TsConfigJson } from 'tsconfig-resolver';
|
||||
import type * as vite from 'vite';
|
||||
import type { RemotePattern } from '../assets/utils/remotePattern';
|
||||
import type { SerializedSSRManifest } from '../core/app/types';
|
||||
import type { PageBuildData } from '../core/build/types';
|
||||
import type { AstroConfigType } from '../core/config';
|
||||
import type { AstroTimer } from '../core/config/timer';
|
||||
import type { AstroCookies } from '../core/cookies';
|
||||
import type { RemotePattern } from '../assets/utils/remotePattern.js';
|
||||
import type { SerializedSSRManifest } from '../core/app/types.js';
|
||||
import type { PageBuildData } from '../core/build/types.js';
|
||||
import type { AstroConfigType } from '../core/config/index.js';
|
||||
import type { AstroTimer } from '../core/config/timer.js';
|
||||
import type { AstroCookies } from '../core/cookies/index.js';
|
||||
import type { ResponseWithEncoding } from '../core/endpoint/index.js';
|
||||
import type { AstroIntegrationLogger, Logger, LoggerLevel } from '../core/logger/core';
|
||||
import type { AstroComponentFactory, AstroComponentInstance } from '../runtime/server';
|
||||
import type { OmitIndexSignature, Simplify } from '../type-utils';
|
||||
import type { AstroIntegrationLogger, Logger, LoggerLevel } from '../core/logger/core.js';
|
||||
import type { AstroComponentFactory, AstroComponentInstance } from '../runtime/server/index.js';
|
||||
import type { OmitIndexSignature, Simplify } from '../type-utils.js';
|
||||
import type { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from './../core/constants.js';
|
||||
|
||||
export { type AstroIntegrationLogger };
|
||||
|
@ -39,7 +39,7 @@ export type {
|
|||
ExternalImageService,
|
||||
ImageService,
|
||||
LocalImageService,
|
||||
} from '../assets/services/service';
|
||||
} from '../assets/services/service.js';
|
||||
export type {
|
||||
GetImageResult,
|
||||
ImageInputFormat,
|
||||
|
@ -48,10 +48,10 @@ export type {
|
|||
ImageQuality,
|
||||
ImageQualityPreset,
|
||||
ImageTransform,
|
||||
} from '../assets/types';
|
||||
export type { RemotePattern } from '../assets/utils/remotePattern';
|
||||
export type { SSRManifest } from '../core/app/types';
|
||||
export type { AstroCookies } from '../core/cookies';
|
||||
} from '../assets/types.js';
|
||||
export type { RemotePattern } from '../assets/utils/remotePattern.js';
|
||||
export type { SSRManifest } from '../core/app/types.js';
|
||||
export type { AstroCookies } from '../core/cookies/index.js';
|
||||
|
||||
export interface AstroBuiltinProps {
|
||||
'client:load'?: boolean;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import fs, { readFileSync } from 'node:fs';
|
||||
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 { isServerLikeOutput } from '../../prerender/utils.js';
|
||||
import { getConfiguredImageService, isESMImportedImage } from '../internal.js';
|
||||
|
|
|
@ -33,7 +33,7 @@ export interface RotateOptions {
|
|||
}
|
||||
|
||||
// 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 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'
|
||||
|
||||
// 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 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'
|
||||
|
||||
// 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 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 = {
|
||||
validate(buffer) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { ICO } from './ico.js'
|
||||
import type { IImage } from './interface'
|
||||
import type { IImage } from './interface.js'
|
||||
|
||||
const TYPE_CURSOR = 2
|
||||
export const CUR: IImage = {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { IImage } from './interface'
|
||||
import type { IImage } from './interface.js'
|
||||
|
||||
export const DDS: IImage = {
|
||||
validate(buffer) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { IImage } from './interface'
|
||||
import type { IImage } from './interface.js'
|
||||
|
||||
const gifRegexp = /^GIF8[79]a/
|
||||
export const GIF: IImage = {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { IImage, ISize } from './interface'
|
||||
import type { IImage, ISize } from './interface.js'
|
||||
|
||||
/**
|
||||
* 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
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { IImage } from './interface'
|
||||
import type { IImage } from './interface.js'
|
||||
|
||||
export const J2C: IImage = {
|
||||
validate(buffer) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { IImage, ISize } from './interface'
|
||||
import type { IImage, ISize } from './interface.js'
|
||||
|
||||
const BoxTypes = {
|
||||
ftyp: '66747970',
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
// if this range we can't detect the file size correctly.
|
||||
|
||||
import { readUInt } from '../readUInt.js'
|
||||
import type { IImage, ISize } from './interface'
|
||||
import type { IImage, ISize } from './interface.js'
|
||||
|
||||
const EXIF_MARKER = '45786966'
|
||||
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'
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { IImage } from './interface'
|
||||
import type { IImage } from './interface.js'
|
||||
|
||||
const pngSignature = 'PNG\r\n\x1a\n'
|
||||
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 } = {
|
||||
P1: 'pbm/ascii',
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { IImage } from './interface'
|
||||
import type { IImage } from './interface.js'
|
||||
|
||||
export const PSD: IImage = {
|
||||
validate(buffer) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { IImage, ISize } from './interface'
|
||||
import type { IImage, ISize } from './interface.js'
|
||||
|
||||
interface IAttributes {
|
||||
width: number | null
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
// TO-DO: support big-endian as well
|
||||
import * as fs from 'node:fs'
|
||||
import { readUInt } from '../readUInt.js'
|
||||
import type { IImage } from './interface'
|
||||
import type { IImage } from './interface.js'
|
||||
|
||||
// Read IFD (image-file-directory) into a buffer
|
||||
function readIFD(buffer: Buffer, filepath: string, isBigEndian: boolean) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// 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 {
|
||||
return {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import MagicString from 'magic-string';
|
||||
import type * as vite from 'vite';
|
||||
import { normalizePath } from 'vite';
|
||||
import type { AstroPluginOptions, ImageTransform } from '../@types/astro';
|
||||
import type { AstroPluginOptions, ImageTransform } from '../@types/astro.js';
|
||||
import {
|
||||
appendForwardSlash,
|
||||
joinPaths,
|
||||
|
|
|
@ -3,13 +3,11 @@ import parser from '@babel/parser';
|
|||
import traverse from '@babel/traverse';
|
||||
import * as t from '@babel/types';
|
||||
|
||||
// @ts-expect-error @babel/traverse isn't ESM and needs this trick
|
||||
export const visit = traverse.default as typeof traverse;
|
||||
export const visit = traverse.default;
|
||||
export { t };
|
||||
|
||||
export async function generate(ast: t.File) {
|
||||
// @ts-expect-error @babel/generator isn't ESM and needs this trick
|
||||
const astToText = generator.default as typeof generator;
|
||||
const astToText = generator.default;
|
||||
const { code } = astToText(ast);
|
||||
return code;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
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';
|
||||
|
||||
export function defineConfig(config: AstroUserConfig) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type fsMod from 'node:fs';
|
||||
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 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 { AstroError } from '../core/errors/errors.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 { CONTENT_TYPES_FILE, VIRTUAL_MODULE_ID } from './consts.js';
|
||||
import {
|
||||
|
|
|
@ -5,7 +5,7 @@ import type { AstroSettings } from '../@types/astro.js';
|
|||
import { moduleIsTopLevelPage, walkParentInfos } from '../core/build/graph.js';
|
||||
import { getPageDataByViteID, type BuildInternals } from '../core/build/internal.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 { createViteLoader } from '../core/module-loader/vite.js';
|
||||
import { joinPaths, prependForwardSlash } from '../core/path.js';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
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 {
|
||||
const routes: RouteInfo[] = [];
|
||||
|
|
|
@ -5,8 +5,8 @@ import type {
|
|||
RouteData,
|
||||
SSRElement,
|
||||
SSRManifest,
|
||||
} from '../../@types/astro';
|
||||
import type { SinglePageBuiltModule } from '../build/types';
|
||||
} from '../../@types/astro.js';
|
||||
import type { SinglePageBuiltModule } from '../build/types.js';
|
||||
import { getSetCookiesFromResponse } from '../cookies/index.js';
|
||||
import { consoleLogDestination } from '../logger/console.js';
|
||||
import { AstroIntegrationLogger, Logger } from '../logger/core.js';
|
||||
|
@ -25,7 +25,7 @@ import {
|
|||
} from '../render/ssr-element.js';
|
||||
import { matchRoute } from '../routing/match.js';
|
||||
import { EndpointNotFoundError, SSRRoutePipeline } from './ssrPipeline.js';
|
||||
import type { RouteInfo } from './types';
|
||||
import type { RouteInfo } from './types.js';
|
||||
export { deserializeManifest } from './common.js';
|
||||
|
||||
const clientLocalsSymbol = Symbol.for('astro.locals');
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import type { RouteData } from '../../@types/astro';
|
||||
import type { SerializedSSRManifest, SSRManifest } from './types';
|
||||
import type { RouteData } from '../../@types/astro.js';
|
||||
import type { SerializedSSRManifest, SSRManifest } from './types.js';
|
||||
|
||||
import * as fs from 'node:fs';
|
||||
import { IncomingMessage } from 'node:http';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
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'
|
||||
|
|
|
@ -4,8 +4,8 @@ import type {
|
|||
SSRComponentMetadata,
|
||||
SSRLoadedRenderer,
|
||||
SSRResult,
|
||||
} from '../../@types/astro';
|
||||
import type { SinglePageBuiltModule } from '../build/types';
|
||||
} from '../../@types/astro.js';
|
||||
import type { SinglePageBuiltModule } from '../build/types.js';
|
||||
|
||||
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 { 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 { Pipeline } from '../pipeline.js';
|
||||
import { createEnvironment } from '../render/index.js';
|
||||
import { createAssetLink } from '../render/ssr-element.js';
|
||||
import type { BuildInternals } from './internal';
|
||||
import type { BuildInternals } from './internal.js';
|
||||
import { ASTRO_PAGE_RESOLVED_MODULE_ID } from './plugins/plugin-pages.js';
|
||||
import { RESOLVED_SPLIT_MODULE_ID } from './plugins/plugin-ssr.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.
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import npath from 'node:path';
|
||||
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';
|
||||
|
||||
const STATUS_CODE_PAGES = new Set(['/404', '/500']);
|
||||
|
|
|
@ -2,7 +2,7 @@ import type { GetModuleInfo } from 'rollup';
|
|||
|
||||
import crypto from 'node:crypto';
|
||||
import npath from 'node:path';
|
||||
import type { AstroSettings } from '../../@types/astro';
|
||||
import type { AstroSettings } from '../../@types/astro.js';
|
||||
import { viteID } from '../util.js';
|
||||
import { getTopLevelPages } from './graph.js';
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ import type {
|
|||
SSRError,
|
||||
SSRLoadedRenderer,
|
||||
SSRManifest,
|
||||
} from '../../@types/astro';
|
||||
} from '../../@types/astro.js';
|
||||
import {
|
||||
generateImage as generateImageInternal,
|
||||
getStaticImageList,
|
||||
|
@ -57,7 +57,7 @@ import type {
|
|||
SinglePageBuiltModule,
|
||||
StaticBuildOptions,
|
||||
StylesheetAsset,
|
||||
} from './types';
|
||||
} from './types.js';
|
||||
import { getTimeStat } from './util.js';
|
||||
|
||||
function createEntryURL(filePath: string, outFolder: URL) {
|
||||
|
|
|
@ -9,7 +9,7 @@ import type {
|
|||
AstroSettings,
|
||||
ManifestData,
|
||||
RuntimeMode,
|
||||
} from '../../@types/astro';
|
||||
} from '../../@types/astro.js';
|
||||
import { injectImageEndpoint } from '../../assets/internal.js';
|
||||
import { telemetry } from '../../events/index.js';
|
||||
import { eventCliSession } from '../../events/session.js';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { Rollup } from 'vite';
|
||||
import type { RouteData, SSRResult } from '../../@types/astro';
|
||||
import type { PageOptions } from '../../vite-plugin-astro/types';
|
||||
import type { RouteData, SSRResult } from '../../@types/astro.js';
|
||||
import type { PageOptions } from '../../vite-plugin-astro/types.js';
|
||||
import { prependForwardSlash, removeFileExtension } from '../path.js';
|
||||
import { viteID } from '../util.js';
|
||||
import {
|
||||
|
@ -9,7 +9,7 @@ import {
|
|||
} from './plugins/plugin-pages.js';
|
||||
import { RESOLVED_SPLIT_MODULE_ID } from './plugins/plugin-ssr.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 {
|
||||
/**
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { AstroSettings, ManifestData } from '../../@types/astro';
|
||||
import type { Logger } from '../logger/core';
|
||||
import type { AllPagesData } from './types';
|
||||
import type { AstroSettings, ManifestData } from '../../@types/astro.js';
|
||||
import type { Logger } from '../logger/core.js';
|
||||
import type { AllPagesData } from './types.js';
|
||||
|
||||
import * as colors from 'kleur/colors';
|
||||
import { debug } from '../logger/core.js';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { Plugin as VitePlugin } from 'vite';
|
||||
import type { BuildInternals } from './internal';
|
||||
import type { StaticBuildOptions, ViteBuildReturn } from './types';
|
||||
import type { BuildInternals } from './internal.js';
|
||||
import type { StaticBuildOptions, ViteBuildReturn } from './types.js';
|
||||
|
||||
type RollupOutputArray = Extract<ViteBuildReturn, Array<any>>;
|
||||
type OutputChunkorAsset = RollupOutputArray[number]['output'][number];
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { astroConfigBuildPlugin } from '../../../content/vite-plugin-content-assets.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 { pluginAnalyzer } from './plugin-analyzer.js';
|
||||
import { pluginComponentEntry } from './plugin-component-entry.js';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { ModuleInfo, PluginContext } from 'rollup';
|
||||
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 { AstroBuildPlugin } from '../plugin.js';
|
||||
|
||||
|
|
|
@ -3,9 +3,9 @@ import * as npath from 'node:path';
|
|||
import type { GetModuleInfo } from 'rollup';
|
||||
import { type ResolvedConfig, type Plugin as VitePlugin } from 'vite';
|
||||
import { isBuildableCSSRequest } from '../../../vite-plugin-astro-server/util.js';
|
||||
import type { BuildInternals } from '../internal';
|
||||
import type { AstroBuildPlugin } from '../plugin';
|
||||
import type { PageBuildData, StaticBuildOptions, StylesheetAsset } from '../types';
|
||||
import type { BuildInternals } from '../internal.js';
|
||||
import type { AstroBuildPlugin } from '../plugin.js';
|
||||
import type { PageBuildData, StaticBuildOptions, StylesheetAsset } from '../types.js';
|
||||
|
||||
import { PROPAGATED_ASSET_FLAG } from '../../../content/consts.js';
|
||||
import * as assetName from '../css-asset-name.js';
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
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 type { BuildInternals } from '../internal.js';
|
||||
import { getPageDataByViteID } from '../internal.js';
|
||||
import type { AstroBuildPlugin } from '../plugin';
|
||||
import type { OutputChunk, StaticBuildOptions } from '../types';
|
||||
import type { AstroBuildPlugin } from '../plugin.js';
|
||||
import type { OutputChunk, StaticBuildOptions } from '../types.js';
|
||||
|
||||
function virtualHoistedEntry(id: string) {
|
||||
return id.startsWith('/astro/hoisted.js?q=');
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { Plugin as VitePlugin } from 'vite';
|
||||
import type { BuildInternals } from '../internal.js';
|
||||
import type { AstroBuildPlugin } from '../plugin';
|
||||
import type { AstroBuildPlugin } from '../plugin.js';
|
||||
import { normalizeEntryId } from './plugin-component-entry.js';
|
||||
|
||||
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 { runHookBuildSsr } from '../../../integrations/index.js';
|
||||
import { BEFORE_HYDRATION_SCRIPT_ID, PAGE_SCRIPT_ID } from '../../../vite-plugin-scripts/index.js';
|
||||
import type { SerializedRouteInfo, SerializedSSRManifest } from '../../app/types';
|
||||
import type { SerializedRouteInfo, SerializedSSRManifest } from '../../app/types.js';
|
||||
import { joinPaths, prependForwardSlash } from '../../path.js';
|
||||
import { serializeRouteData } from '../../routing/index.js';
|
||||
import { addRollupInput } from '../add-rollup-input.js';
|
||||
import { getOutFile, getOutFolder } from '../common.js';
|
||||
import { cssOrder, mergeInlineCss, type BuildInternals } from '../internal.js';
|
||||
import type { AstroBuildPlugin } from '../plugin';
|
||||
import type { StaticBuildOptions } from '../types';
|
||||
import type { AstroBuildPlugin } from '../plugin.js';
|
||||
import type { StaticBuildOptions } from '../types.js';
|
||||
|
||||
const manifestReplace = '@@ASTRO_MANIFEST_REPLACE@@';
|
||||
const replaceExp = new RegExp(`['"](${manifestReplace})['"]`, 'g');
|
||||
|
@ -46,8 +46,8 @@ function vitePluginManifest(options: StaticBuildOptions, internals: BuildInterna
|
|||
`import { _privateSetManifestDontUseThis } from 'astro:ssr-manifest'`
|
||||
);
|
||||
|
||||
contents.push(`
|
||||
const manifest = _deserializeManifest('${manifestReplace}');
|
||||
contents.push(`
|
||||
const manifest = _deserializeManifest('${manifestReplace}');
|
||||
_privateSetManifestDontUseThis(manifest);
|
||||
`);
|
||||
|
||||
|
|
|
@ -2,9 +2,9 @@ import type { Plugin as VitePlugin } from 'vite';
|
|||
import { getOutputDirectory } from '../../../prerender/utils.js';
|
||||
import { MIDDLEWARE_PATH_SEGMENT_NAME } from '../../constants.js';
|
||||
import { addRollupInput } from '../add-rollup-input.js';
|
||||
import type { BuildInternals } from '../internal';
|
||||
import type { AstroBuildPlugin } from '../plugin';
|
||||
import type { StaticBuildOptions } from '../types';
|
||||
import type { BuildInternals } from '../internal.js';
|
||||
import type { AstroBuildPlugin } from '../plugin.js';
|
||||
import type { StaticBuildOptions } from '../types.js';
|
||||
|
||||
export const MIDDLEWARE_MODULE_ID = '@astro-middleware';
|
||||
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import { extname } from 'node:path';
|
||||
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 { addRollupInput } from '../add-rollup-input.js';
|
||||
import { type BuildInternals } from '../internal.js';
|
||||
import type { AstroBuildPlugin } from '../plugin';
|
||||
import type { StaticBuildOptions } from '../types';
|
||||
import type { AstroBuildPlugin } from '../plugin.js';
|
||||
import type { StaticBuildOptions } from '../types.js';
|
||||
import { MIDDLEWARE_MODULE_ID } from './plugin-middleware.js';
|
||||
import { RENDERERS_MODULE_ID } from './plugin-renderers.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 type { BuildInternals } from '../internal.js';
|
||||
import type { AstroBuildPlugin } from '../plugin.js';
|
||||
import type { StaticBuildOptions } from '../types';
|
||||
import type { StaticBuildOptions } from '../types.js';
|
||||
import { extendManualChunks } from './util.js';
|
||||
|
||||
function vitePluginPrerender(opts: StaticBuildOptions, internals: BuildInternals): VitePlugin {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import type { Plugin as VitePlugin } from 'vite';
|
||||
import { addRollupInput } from '../add-rollup-input.js';
|
||||
import type { AstroBuildPlugin } from '../plugin';
|
||||
import type { StaticBuildOptions } from '../types';
|
||||
import type { AstroBuildPlugin } from '../plugin.js';
|
||||
import type { StaticBuildOptions } from '../types.js';
|
||||
|
||||
export const RENDERERS_MODULE_ID = '@astro-renderers';
|
||||
export const RESOLVED_RENDERERS_MODULE_ID = `\0${RENDERERS_MODULE_ID}`;
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import { join } from 'node:path';
|
||||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||
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 { isServerLikeOutput } from '../../../prerender/utils.js';
|
||||
import { routeIsRedirect } from '../../redirects/index.js';
|
||||
import { addRollupInput } from '../add-rollup-input.js';
|
||||
import type { BuildInternals } from '../internal.js';
|
||||
import type { AstroBuildPlugin } from '../plugin';
|
||||
import type { StaticBuildOptions } from '../types';
|
||||
import type { AstroBuildPlugin } from '../plugin.js';
|
||||
import type { StaticBuildOptions } from '../types.js';
|
||||
import { SSR_MANIFEST_VIRTUAL_MODULE_ID } from './plugin-manifest.js';
|
||||
import { ASTRO_PAGE_MODULE_ID } from './plugin-pages.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}';
|
||||
import { renderers } from '${RENDERERS_MODULE_ID}';
|
||||
import { manifest as defaultManifest} from '${SSR_MANIFEST_VIRTUAL_MODULE_ID}';
|
||||
import { renderers } from '${RENDERERS_MODULE_ID}';
|
||||
import { manifest as defaultManifest} from '${SSR_MANIFEST_VIRTUAL_MODULE_ID}';
|
||||
const _manifest = Object.assign(defaultManifest, {
|
||||
${pageMap},
|
||||
renderers,
|
||||
|
|
|
@ -6,7 +6,7 @@ import fs from 'node:fs';
|
|||
import path, { extname } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import * as vite from 'vite';
|
||||
import type { RouteData } from '../../@types/astro';
|
||||
import type { RouteData } from '../../@types/astro.js';
|
||||
import {
|
||||
createBuildInternals,
|
||||
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_SPLIT_MODULE_ID, RESOLVED_SSR_VIRTUAL_MODULE_ID } from './plugins/plugin-ssr.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';
|
||||
|
||||
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 {
|
||||
AstroConfig,
|
||||
AstroSettings,
|
||||
|
@ -8,9 +9,9 @@ import type {
|
|||
RouteData,
|
||||
RuntimeMode,
|
||||
SSRLoadedRenderer,
|
||||
} from '../../@types/astro';
|
||||
import type { Logger } from '../logger/core';
|
||||
import type { RouteCache } from '../render/route-cache';
|
||||
} from '../../@types/astro.js';
|
||||
import type { Logger } from '../logger/core.js';
|
||||
import type { RouteCache } from '../render/route-cache.js';
|
||||
|
||||
export type ComponentPath = 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';
|
||||
|
||||
type CompilationCache = Map<string, CompileResult>;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { TransformResult } from '@astrojs/compiler';
|
||||
import type { ResolvedConfig } from 'vite';
|
||||
import type { AstroConfig } from '../../@types/astro';
|
||||
import type { AstroConfig } from '../../@types/astro.js';
|
||||
|
||||
import { transform } from '@astrojs/compiler';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
|
|
@ -4,5 +4,5 @@ export {
|
|||
invalidateCompilation,
|
||||
isCached,
|
||||
} from './cache.js';
|
||||
export type { CompileProps, CompileResult } from './compile';
|
||||
export type { TransformStyle } from './types';
|
||||
export type { CompileProps, CompileResult } from './compile.js';
|
||||
export type { TransformStyle } from './types.js';
|
||||
|
|
|
@ -5,7 +5,7 @@ import type {
|
|||
AstroInlineOnlyConfig,
|
||||
AstroUserConfig,
|
||||
CLIFlags,
|
||||
} from '../../@types/astro';
|
||||
} from '../../@types/astro.js';
|
||||
|
||||
import * as colors from 'kleur/colors';
|
||||
import fs from 'node:fs';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
export { resolveConfig, resolveConfigPath, resolveFlags, resolveRoot } from './config.js';
|
||||
export { createNodeLogger } from './logging.js';
|
||||
export { mergeConfig } from './merge.js';
|
||||
export type { AstroConfigType } from './schema';
|
||||
export type { AstroConfigType } from './schema.js';
|
||||
export { createSettings } from './settings.js';
|
||||
export { loadTSConfig, updateTSConfigForFramework } from './tsconfig.js';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import type { RehypePlugin, RemarkPlugin, RemarkRehype } from '@astrojs/markdown-remark';
|
||||
import { markdownConfigDefaults } from '@astrojs/markdown-remark';
|
||||
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 path from 'node:path';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import yaml from 'js-yaml';
|
||||
import path from 'node:path';
|
||||
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 { markdownContentEntryType } from '../../vite-plugin-markdown/content-entry-type.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');
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import type { AstroSettings } from '../@types/astro';
|
||||
import type { Logger } from './logger/core';
|
||||
import type { AstroSettings } from '../@types/astro.js';
|
||||
import type { Logger } from './logger/core.js';
|
||||
|
||||
import nodeFs from 'node:fs';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
|
@ -168,7 +168,7 @@ export async function createVite(
|
|||
{
|
||||
// Typings are imported from 'astro' (e.g. import { Type } from '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',
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type * as http from 'node:http';
|
||||
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 * as vite from 'vite';
|
||||
|
|
|
@ -3,7 +3,7 @@ import type http from 'node:http';
|
|||
import type { AddressInfo } from 'node:net';
|
||||
import { performance } from 'perf_hooks';
|
||||
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 { telemetry } from '../../events/index.js';
|
||||
import * as msg from '../messages.js';
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import nodeFs from 'node:fs';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
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 { createNodeLogger, createSettings, resolveConfig } from '../config/index.js';
|
||||
import { collectErrorMetadata } from '../errors/dev/utils.js';
|
||||
import { isAstroConfigZodError } from '../errors/errors.js';
|
||||
import { createSafeError } from '../errors/index.js';
|
||||
import { formatErrorMessage } from '../messages.js';
|
||||
import type { Container } from './container';
|
||||
import type { Container } from './container.js';
|
||||
import { createContainer, startContainer } from './container.js';
|
||||
|
||||
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 { callEndpoint } from '../index.js';
|
||||
|
||||
|
|
|
@ -6,13 +6,13 @@ import type {
|
|||
MiddlewareEndpointHandler,
|
||||
MiddlewareHandler,
|
||||
Params,
|
||||
} from '../../@types/astro';
|
||||
} from '../../@types/astro.js';
|
||||
import { renderEndpoint } from '../../runtime/server/index.js';
|
||||
import { ASTRO_VERSION } from '../constants.js';
|
||||
import { AstroCookies, attachCookiesToResponse } from '../cookies/index.js';
|
||||
import { AstroError, AstroErrorData } from '../errors/index.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();
|
||||
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
export type { ErrorLocation, ErrorWithMetadata } from './errors';
|
||||
export * as AstroErrorData from './errors-data.js';
|
||||
export {
|
||||
AggregateError,
|
||||
|
@ -9,5 +8,6 @@ export {
|
|||
MarkdownError,
|
||||
isAstroError,
|
||||
} from './errors.js';
|
||||
export type { ErrorLocation, ErrorWithMetadata } from './errors.js';
|
||||
export { codeFrame } from './printer.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 */ `
|
||||
* {
|
||||
|
|
|
@ -4,9 +4,9 @@ import type {
|
|||
EndpointOutput,
|
||||
MiddlewareHandler,
|
||||
MiddlewareNext,
|
||||
} from '../../@types/astro';
|
||||
} from '../../@types/astro.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.
|
||||
|
|
|
@ -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 { 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 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.
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { APIContext, MiddlewareResponseHandler } from '../../@types/astro';
|
||||
import type { APIContext, MiddlewareResponseHandler } from '../../@types/astro.js';
|
||||
import { defineMiddleware } from './index.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 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
|
||||
// fulfilled by Vite, see vite.ts
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { EventEmitter } from 'node:events';
|
||||
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 {
|
||||
const events = new EventEmitter() as ModuleLoaderEventEmitter;
|
||||
|
|
|
@ -4,7 +4,7 @@ import type {
|
|||
MiddlewareEndpointHandler,
|
||||
MiddlewareHandler,
|
||||
MiddlewareResponseHandler,
|
||||
} from '../@types/astro';
|
||||
} from '../@types/astro.js';
|
||||
import { callEndpoint, createAPIContext } from './endpoint/index.js';
|
||||
import { callMiddleware } from './middleware/callMiddleware.js';
|
||||
import { renderPage } from './render/core.js';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { createRequire } from 'node:module';
|
||||
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 { telemetry } from '../../events/index.js';
|
||||
import { eventCliSession } from '../../events/session.js';
|
||||
|
|
|
@ -3,8 +3,8 @@ import { fileURLToPath } from 'node:url';
|
|||
import { performance } from 'perf_hooks';
|
||||
import enableDestroy from 'server-destroy';
|
||||
import { preview, type PreviewServer as VitePreviewServer } from 'vite';
|
||||
import type { AstroSettings } from '../../@types/astro';
|
||||
import type { Logger } from '../logger/core';
|
||||
import type { AstroSettings } from '../../@types/astro.js';
|
||||
import type { Logger } from '../logger/core.js';
|
||||
import * as msg from '../messages.js';
|
||||
import { getResolvedHostForHttpServer } from './util.js';
|
||||
import { vitePluginAstroPreview } from './vite-plugin-astro-preview.js';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import type { ComponentInstance } from '../../@types/astro';
|
||||
import type { SinglePageBuiltModule } from '../build/types';
|
||||
import type { ComponentInstance } from '../../@types/astro.js';
|
||||
import type { SinglePageBuiltModule } from '../build/types.js';
|
||||
|
||||
// A stub of a component instance for a given route
|
||||
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 {
|
||||
return route?.type === 'redirect';
|
||||
|
|
|
@ -5,9 +5,9 @@ import type {
|
|||
RouteData,
|
||||
SSRElement,
|
||||
SSRResult,
|
||||
} from '../../@types/astro';
|
||||
} from '../../@types/astro.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';
|
||||
|
||||
const clientLocalsSymbol = Symbol.for('astro.locals');
|
||||
|
|
|
@ -4,7 +4,7 @@ import type {
|
|||
EndpointHandler,
|
||||
MiddlewareHandler,
|
||||
MiddlewareResponseHandler,
|
||||
} from '../../@types/astro';
|
||||
} from '../../@types/astro.js';
|
||||
import { renderPage as runtimeRenderPage } from '../../runtime/server/index.js';
|
||||
import { attachCookiesToResponse } from '../cookies/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 { RouteCache } from './route-cache.js';
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import type { AstroMiddlewareInstance, ComponentInstance, RouteData } from '../../@types/astro';
|
||||
import type { Environment } from './environment';
|
||||
import type { AstroMiddlewareInstance, ComponentInstance, RouteData } from '../../@types/astro.js';
|
||||
import type { Environment } from './environment.js';
|
||||
export { createRenderContext } from './context.js';
|
||||
export type { RenderContext } from './context.js';
|
||||
export { tryRenderRoute } from './core.js';
|
||||
|
|
|
@ -5,7 +5,7 @@ import type {
|
|||
Params,
|
||||
Props,
|
||||
RouteData,
|
||||
} from '../../@types/astro';
|
||||
} from '../../@types/astro.js';
|
||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||
|
||||
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 type { Logger } from '../logger/core.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';
|
||||
|
||||
export async function loadRenderer(
|
||||
|
|
|
@ -5,7 +5,7 @@ import type {
|
|||
SSRElement,
|
||||
SSRLoadedRenderer,
|
||||
SSRResult,
|
||||
} from '../../@types/astro';
|
||||
} from '../../@types/astro.js';
|
||||
import { renderSlotToString, type ComponentSlots } from '../../runtime/server/index.js';
|
||||
import { renderJSX } from '../../runtime/server/jsx.js';
|
||||
import { chunkToString } from '../../runtime/server/render/index.js';
|
||||
|
|
|
@ -7,7 +7,7 @@ import type {
|
|||
Params,
|
||||
RouteData,
|
||||
RuntimeMode,
|
||||
} from '../../@types/astro';
|
||||
} from '../../@types/astro.js';
|
||||
import { AstroError, AstroErrorData } from '../errors/index.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 type { StylesheetAsset } from '../app/types';
|
||||
import type { StylesheetAsset } from '../app/types.js';
|
||||
|
||||
export function createAssetLink(href: string, base?: string, assetsPrefix?: string): string {
|
||||
if (assetsPrefix) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
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 RequestBody = ArrayBuffer | Blob | ReadableStream | URLSearchParams | FormData;
|
||||
|
|
|
@ -5,8 +5,8 @@ import type {
|
|||
ManifestData,
|
||||
RouteData,
|
||||
RoutePart,
|
||||
} from '../../../@types/astro';
|
||||
import type { Logger } from '../../logger/core';
|
||||
} from '../../../@types/astro.js';
|
||||
import type { Logger } from '../../logger/core.js';
|
||||
|
||||
import { createRequire } from 'module';
|
||||
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';
|
||||
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import type { ManifestData, RouteData } from '../../@types/astro';
|
||||
import type { ManifestData, RouteData } from '../../@types/astro.js';
|
||||
|
||||
/** Find matching route from pathname */
|
||||
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 { 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 type { Logger } from '../logger/core';
|
||||
import type { Logger } from '../logger/core.js';
|
||||
|
||||
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