mirror of
https://github.com/withastro/astro.git
synced 2024-12-16 21:46:22 -05:00
chore: import sort astro
package (#10245)
* chore: import sort source code, exception for the `astro` package * fix import sorting bug * chore: import sorting for the `astro` package
This commit is contained in:
parent
dbb0d0bd28
commit
08cdd0919d
106 changed files with 235 additions and 235 deletions
|
@ -2,7 +2,7 @@
|
|||
"$schema": "https://biomejs.dev/schemas/1.5.3/schema.json",
|
||||
"files": {
|
||||
"include": ["test/**", "e2e/**", "packages/**"],
|
||||
"ignore": ["vendor", "dist/**", "packages/astro/**"]
|
||||
"ignore": ["vendor", "dist/**"]
|
||||
},
|
||||
"organizeImports": {
|
||||
"enabled": true
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* eslint-disable no-console */
|
||||
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { bold, cyan, dim } from 'kleur/colors';
|
||||
import yargs from 'yargs-parser';
|
||||
import { loadFixture } from '../test/test-utils.js';
|
||||
import { generatePosts } from './scripts/generate-posts.mjs';
|
||||
import yargs from 'yargs-parser';
|
||||
import { cyan, bold, dim } from 'kleur/colors';
|
||||
|
||||
// Skip nonessential remark / rehype plugins for a fair comparison.
|
||||
// This includes heading ID generation, syntax highlighting, GFM, and Smartypants.
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { defineConfig } from 'astro/config';
|
||||
import react from "@astrojs/react";
|
||||
import { defineConfig } from 'astro/config';
|
||||
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { defineConfig } from 'astro/config';
|
||||
import markdoc from "@astrojs/markdoc";
|
||||
import react from "@astrojs/react";
|
||||
import { defineConfig } from 'astro/config';
|
||||
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { defineConfig } from 'astro/config';
|
||||
import mdx from "@astrojs/mdx";
|
||||
import react from "@astrojs/react";
|
||||
import { defineConfig } from 'astro/config';
|
||||
|
||||
// https://astro.build/config
|
||||
export default defineConfig({
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import type { OutgoingHttpHeaders } from 'node:http';
|
||||
import type { AddressInfo } from 'node:net';
|
||||
import type {
|
||||
MarkdownHeading,
|
||||
MarkdownMetadata,
|
||||
|
@ -8,8 +10,6 @@ import type {
|
|||
ShikiConfig,
|
||||
} from '@astrojs/markdown-remark';
|
||||
import type * as babel from '@babel/core';
|
||||
import type { OutgoingHttpHeaders } from 'node:http';
|
||||
import type { AddressInfo } from 'node:net';
|
||||
import type * as rollup from 'rollup';
|
||||
import type * as vite from 'vite';
|
||||
import type { RemotePattern } from '../assets/utils/remotePattern.js';
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { dim, green } from 'kleur/colors';
|
||||
import fs, { readFileSync } from 'node:fs';
|
||||
import { basename, join } from 'node:path/posix';
|
||||
import { dim, green } from 'kleur/colors';
|
||||
import type PQueue from 'p-queue';
|
||||
import type { AstroConfig } from '../../@types/astro.js';
|
||||
import type { BuildPipeline } from '../../core/build/pipeline.js';
|
||||
import { getOutDirWithinCwd } from '../../core/build/common.js';
|
||||
import type { BuildPipeline } from '../../core/build/pipeline.js';
|
||||
import { getTimeStat } from '../../core/build/util.js';
|
||||
import { AstroError } from '../../core/errors/errors.js';
|
||||
import { AstroErrorData } from '../../core/errors/index.js';
|
||||
|
@ -16,7 +16,7 @@ import { getConfiguredImageService } from '../internal.js';
|
|||
import type { LocalImageService } from '../services/service.js';
|
||||
import type { AssetsGlobalStaticImagesList, ImageMetadata, ImageTransform } from '../types.js';
|
||||
import { isESMImportedImage } from '../utils/imageKind.js';
|
||||
import { loadRemoteImage, type RemoteCacheEntry } from './remote.js';
|
||||
import { type RemoteCacheEntry, loadRemoteImage } from './remote.js';
|
||||
|
||||
interface GenerationDataUncached {
|
||||
cached: false;
|
||||
|
|
|
@ -3,9 +3,9 @@ import mime from 'mime/lite.js';
|
|||
import type { APIRoute } from '../../@types/astro.js';
|
||||
import { getConfiguredImageService } from '../internal.js';
|
||||
import { etag } from '../utils/etag.js';
|
||||
import { isRemoteAllowed } from '../utils/remotePattern.js';
|
||||
// @ts-expect-error
|
||||
import { imageConfig } from 'astro:assets';
|
||||
import { isRemoteAllowed } from '../utils/remotePattern.js';
|
||||
|
||||
async function loadRemoteImage(src: URL) {
|
||||
try {
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import os from 'os';
|
||||
import { isRemotePath, removeQueryString } from '@astrojs/internal-helpers/path';
|
||||
import { readFile } from 'fs/promises';
|
||||
import mime from 'mime/lite.js';
|
||||
import os from 'os';
|
||||
import type { APIRoute } from '../../@types/astro.js';
|
||||
import { getConfiguredImageService } from '../internal.js';
|
||||
import { etag } from '../utils/etag.js';
|
||||
import { isRemoteAllowed } from '../utils/remotePattern.js';
|
||||
// @ts-expect-error
|
||||
import { assetsDir, imageConfig } from 'astro:assets';
|
||||
import { isRemoteAllowed } from '../utils/remotePattern.js';
|
||||
|
||||
function replaceFileSystemReferences(src: string) {
|
||||
return os.platform().includes('win32') ? src.replace(/^\/@fs\//, '') : src.replace(/^\/@fs/, '');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import type { AstroConfig } from '../@types/astro.js';
|
||||
import { AstroError, AstroErrorData } from '../core/errors/index.js';
|
||||
import { DEFAULT_HASH_PROPS } from './consts.js';
|
||||
import { isLocalService, type ImageService } from './services/service.js';
|
||||
import { type ImageService, isLocalService } from './services/service.js';
|
||||
import type {
|
||||
GetImageResult,
|
||||
ImageTransform,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { baseService, type LocalImageService } from './service.js';
|
||||
import { type LocalImageService, baseService } from './service.js';
|
||||
|
||||
// Empty service used for platforms that neither support Squoosh or Sharp.
|
||||
const noopService: LocalImageService = {
|
||||
|
|
|
@ -2,10 +2,10 @@ import type { FormatEnum, SharpOptions } from 'sharp';
|
|||
import { AstroError, AstroErrorData } from '../../core/errors/index.js';
|
||||
import type { ImageOutputFormat, ImageQualityPreset } from '../types.js';
|
||||
import {
|
||||
baseService,
|
||||
parseQuality,
|
||||
type BaseServiceTransform,
|
||||
type LocalImageService,
|
||||
baseService,
|
||||
parseQuality,
|
||||
} from './service.js';
|
||||
|
||||
export interface SharpImageServiceConfig {
|
||||
|
|
|
@ -3,10 +3,10 @@
|
|||
import type { ImageOutputFormat, ImageQualityPreset } from '../types.js';
|
||||
import { imageMetadata } from '../utils/metadata.js';
|
||||
import {
|
||||
baseService,
|
||||
parseQuality,
|
||||
type BaseServiceTransform,
|
||||
type LocalImageService,
|
||||
baseService,
|
||||
parseQuality,
|
||||
} from './service.js';
|
||||
import { processBuffer } from './vendor/squoosh/image-pool.js';
|
||||
import type { Operation } from './vendor/squoosh/image.js';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { lookup as probe } from '../utils/vendor/image-size/lookup.js';
|
||||
import { AstroError, AstroErrorData } from '../../core/errors/index.js';
|
||||
import type { ImageInputFormat, ImageMetadata } from '../types.js';
|
||||
import { lookup as probe } from '../utils/vendor/image-size/lookup.js';
|
||||
|
||||
export async function imageMetadata(
|
||||
data: Uint8Array,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { deterministicString } from 'deterministic-object-hash';
|
||||
import { basename, extname } from 'node:path';
|
||||
import { deterministicString } from 'deterministic-object-hash';
|
||||
import { removeQueryString } from '../../core/path.js';
|
||||
import { shorthash } from '../../runtime/server/shorthash.js';
|
||||
import type { ImageTransform } from '../types.js';
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import fsMod, { existsSync, promises as fs } from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||
import boxen from 'boxen';
|
||||
import { diffWords } from 'diff';
|
||||
import { execa } from 'execa';
|
||||
import { bold, cyan, dim, green, magenta, red, yellow } from 'kleur/colors';
|
||||
import fsMod, { existsSync, promises as fs } from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||
import maxSatisfying from 'semver/ranges/max-satisfying.js';
|
||||
import ora from 'ora';
|
||||
import preferredPM from 'preferred-pm';
|
||||
import prompts from 'prompts';
|
||||
import maxSatisfying from 'semver/ranges/max-satisfying.js';
|
||||
import type yargs from 'yargs-parser';
|
||||
import {
|
||||
loadTSConfig,
|
||||
|
@ -18,9 +18,9 @@ import {
|
|||
} from '../../core/config/index.js';
|
||||
import {
|
||||
defaultTSConfig,
|
||||
type frameworkWithTSSettings,
|
||||
presets,
|
||||
updateTSConfigForFramework,
|
||||
type frameworkWithTSSettings,
|
||||
} from '../../core/config/tsconfig.js';
|
||||
import type { Logger } from '../../core/logger/core.js';
|
||||
import * as msg from '../../core/messages.js';
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import path from 'node:path';
|
||||
import type { Arguments } from 'yargs-parser';
|
||||
import { ensureProcessNodeEnv } from '../../core/util.js';
|
||||
import { createLoggerFromFlags, flagsToAstroInlineConfig } from '../flags.js';
|
||||
import { getPackage } from '../install-package.js';
|
||||
import { ensureProcessNodeEnv } from '../../core/util.js';
|
||||
|
||||
export async function check(flags: Arguments) {
|
||||
ensureProcessNodeEnv('production');
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import type { Arguments } from 'yargs-parser';
|
||||
import type { AstroConfig } from '../../@types/astro.js';
|
||||
import { resolveConfig } from '../../core/config/config.js';
|
||||
import { apply as applyPolyfill } from '../../core/polyfill.js';
|
||||
import { createLoggerFromFlags, flagsToAstroInlineConfig } from '../flags.js';
|
||||
import { getPackage } from '../install-package.js';
|
||||
import { resolveConfig } from '../../core/config/config.js';
|
||||
import type { AstroConfig } from '../../@types/astro.js';
|
||||
import { apply as applyPolyfill } from '../../core/polyfill.js';
|
||||
|
||||
type DBPackage = {
|
||||
cli: (args: { flags: Arguments; config: AstroConfig }) => unknown;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { Arguments as Flags } from 'yargs-parser';
|
||||
import type { AstroInlineConfig } from '../@types/astro.js';
|
||||
import { Logger, type LogOptions } from '../core/logger/core.js';
|
||||
import { type LogOptions, Logger } from '../core/logger/core.js';
|
||||
import { nodeLogDestination } from '../core/logger/node.js';
|
||||
|
||||
export function flagsToAstroInlineConfig(flags: Flags): AstroInlineConfig {
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
/* eslint-disable no-console */
|
||||
import * as colors from 'kleur/colors';
|
||||
import { execSync } from 'node:child_process';
|
||||
import { arch, platform } from 'node:os';
|
||||
/* eslint-disable no-console */
|
||||
import * as colors from 'kleur/colors';
|
||||
import prompts from 'prompts';
|
||||
import type yargs from 'yargs-parser';
|
||||
import type { AstroConfig, AstroUserConfig } from '../../@types/astro.js';
|
||||
import { resolveConfig } from '../../core/config/index.js';
|
||||
import { ASTRO_VERSION } from '../../core/constants.js';
|
||||
import { flagsToAstroInlineConfig } from '../flags.js';
|
||||
import { apply as applyPolyfill } from '../../core/polyfill.js';
|
||||
import { flagsToAstroInlineConfig } from '../flags.js';
|
||||
|
||||
interface InfoOptions {
|
||||
flags: yargs.Arguments;
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
import { createRequire } from 'node:module';
|
||||
import { sep } from 'node:path';
|
||||
import boxen from 'boxen';
|
||||
import { execa } from 'execa';
|
||||
import { bold, cyan, dim, magenta } from 'kleur/colors';
|
||||
|
@ -6,8 +8,6 @@ import prompts from 'prompts';
|
|||
import resolvePackage from 'resolve';
|
||||
import whichPm from 'which-pm';
|
||||
import { type Logger } from '../core/logger/core.js';
|
||||
import { createRequire } from 'node:module';
|
||||
import { sep } from 'node:path';
|
||||
const require = createRequire(import.meta.url);
|
||||
|
||||
type GetPackageOptions = {
|
||||
|
|
|
@ -2,21 +2,21 @@
|
|||
import type yargs from 'yargs-parser';
|
||||
import type { AstroSettings } from '../../@types/astro.js';
|
||||
|
||||
import { bgGreen, black, bold, dim, yellow } from 'kleur/colors';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { bgGreen, black, bold, dim, yellow } from 'kleur/colors';
|
||||
|
||||
import { formatWithOptions } from 'node:util';
|
||||
import dlv from 'dlv';
|
||||
import { resolveConfig } from '../../core/config/config.js';
|
||||
import { createSettings } from '../../core/config/settings.js';
|
||||
import * as msg from '../../core/messages.js';
|
||||
import { DEFAULT_PREFERENCES } from '../../preferences/defaults.js';
|
||||
import { coerce, isValidKey, type PreferenceKey } from '../../preferences/index.js';
|
||||
import { createLoggerFromFlags, flagsToAstroInlineConfig } from '../flags.js';
|
||||
// @ts-expect-error flattie types are mispackaged
|
||||
import { flattie } from 'flattie';
|
||||
import { formatWithOptions } from 'node:util';
|
||||
import { resolveConfig } from '../../core/config/config.js';
|
||||
import { createSettings } from '../../core/config/settings.js';
|
||||
import { collectErrorMetadata } from '../../core/errors/dev/utils.js';
|
||||
import * as msg from '../../core/messages.js';
|
||||
import { apply as applyPolyfill } from '../../core/polyfill.js';
|
||||
import { DEFAULT_PREFERENCES } from '../../preferences/defaults.js';
|
||||
import { type PreferenceKey, coerce, isValidKey } from '../../preferences/index.js';
|
||||
import { createLoggerFromFlags, flagsToAstroInlineConfig } from '../flags.js';
|
||||
|
||||
interface PreferencesOptions {
|
||||
flags: yargs.Arguments;
|
||||
|
|
|
@ -3,6 +3,7 @@ import { ZodIssueCode, string as zodString } from 'zod';
|
|||
import { AstroError, AstroErrorData } from '../core/errors/index.js';
|
||||
import { prependForwardSlash } from '../core/path.js';
|
||||
import {
|
||||
type AstroComponentFactory,
|
||||
createComponent,
|
||||
createHeadAndContent,
|
||||
renderComponent,
|
||||
|
@ -10,7 +11,6 @@ import {
|
|||
renderTemplate,
|
||||
renderUniqueStylesheet,
|
||||
unescapeHTML,
|
||||
type AstroComponentFactory,
|
||||
} from '../runtime/server/index.js';
|
||||
import type { ContentLookupMap } from './utils.js';
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import { bold, cyan, underline } from 'kleur/colors';
|
||||
import type fsMod from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||
import { bold, cyan, underline } from 'kleur/colors';
|
||||
import type { ViteDevServer } from 'vite';
|
||||
import type { AstroSettings } from '../@types/astro.js';
|
||||
import { loadTSConfig } from '../core/config/tsconfig.js';
|
||||
import type { Logger } from '../core/logger/core.js';
|
||||
import { appendForwardSlash } from '../core/path.js';
|
||||
import { createContentTypesGenerator } from './types-generator.js';
|
||||
import { getContentPaths, globalContentConfigObserver, type ContentPaths } from './utils.js';
|
||||
import { type ContentPaths, getContentPaths, globalContentConfigObserver } from './utils.js';
|
||||
|
||||
interface ContentServerListenerParams {
|
||||
fs: typeof fsMod;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import glob from 'fast-glob';
|
||||
import { bold, cyan } from 'kleur/colors';
|
||||
import type fsMod from 'node:fs';
|
||||
import * as path from 'node:path';
|
||||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||
import { normalizePath, type ViteDevServer } from 'vite';
|
||||
import glob from 'fast-glob';
|
||||
import { bold, cyan } from 'kleur/colors';
|
||||
import { type ViteDevServer, normalizePath } from 'vite';
|
||||
import type { AstroSettings, ContentEntryType } from '../@types/astro.js';
|
||||
import { AstroError } from '../core/errors/errors.js';
|
||||
import { AstroErrorData } from '../core/errors/index.js';
|
||||
|
@ -11,6 +11,9 @@ 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 {
|
||||
type ContentConfig,
|
||||
type ContentObservable,
|
||||
type ContentPaths,
|
||||
getContentEntryIdAndSlug,
|
||||
getContentPaths,
|
||||
getDataEntryExts,
|
||||
|
@ -20,9 +23,6 @@ import {
|
|||
getEntrySlug,
|
||||
getEntryType,
|
||||
reloadContentConfigObserver,
|
||||
type ContentConfig,
|
||||
type ContentObservable,
|
||||
type ContentPaths,
|
||||
} from './utils.js';
|
||||
|
||||
type ChokidarEvent = 'add' | 'addDir' | 'change' | 'unlink' | 'unlinkDir';
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { slug as githubSlug } from 'github-slugger';
|
||||
import matter from 'gray-matter';
|
||||
import fsMod from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||
import { slug as githubSlug } from 'github-slugger';
|
||||
import matter from 'gray-matter';
|
||||
import type { PluginContext } from 'rollup';
|
||||
import { normalizePath, type ViteDevServer } from 'vite';
|
||||
import { type ViteDevServer, normalizePath } from 'vite';
|
||||
import { z } from 'zod';
|
||||
import type {
|
||||
AstroConfig,
|
||||
|
|
|
@ -3,7 +3,7 @@ import { pathToFileURL } from 'node:url';
|
|||
import type { Plugin, Rollup } from 'vite';
|
||||
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 BuildInternals, getPageDataByViteID } from '../core/build/internal.js';
|
||||
import type { AstroBuildPlugin } from '../core/build/plugin.js';
|
||||
import type { StaticBuildOptions } from '../core/build/types.js';
|
||||
import type { ModuleLoader } from '../core/module-loader/loader.js';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import * as devalue from 'devalue';
|
||||
import type fsMod from 'node:fs';
|
||||
import { extname } from 'node:path';
|
||||
import { pathToFileURL } from 'node:url';
|
||||
import * as devalue from 'devalue';
|
||||
import type { PluginContext } from 'rollup';
|
||||
import type { Plugin } from 'vite';
|
||||
import type {
|
||||
|
@ -18,6 +18,7 @@ import { AstroErrorData } from '../core/errors/index.js';
|
|||
import { isServerLikeOutput } from '../prerender/utils.js';
|
||||
import { CONTENT_FLAG, DATA_FLAG } from './consts.js';
|
||||
import {
|
||||
type ContentConfig,
|
||||
getContentEntryExts,
|
||||
getContentEntryIdAndSlug,
|
||||
getContentPaths,
|
||||
|
@ -31,7 +32,6 @@ import {
|
|||
hasContentFlag,
|
||||
parseEntrySlug,
|
||||
reloadContentConfigObserver,
|
||||
type ContentConfig,
|
||||
} from './utils.js';
|
||||
|
||||
function getContentRendererByViteId(
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import glob from 'fast-glob';
|
||||
import nodeFs from 'node:fs';
|
||||
import { extname } from 'node:path';
|
||||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||
import glob from 'fast-glob';
|
||||
import pLimit from 'p-limit';
|
||||
import { type Plugin } from 'vite';
|
||||
import type { AstroSettings } from '../@types/astro.js';
|
||||
|
@ -19,6 +19,7 @@ import {
|
|||
VIRTUAL_MODULE_ID,
|
||||
} from './consts.js';
|
||||
import {
|
||||
type ContentLookupMap,
|
||||
getContentEntryIdAndSlug,
|
||||
getContentPaths,
|
||||
getDataEntryExts,
|
||||
|
@ -28,7 +29,6 @@ import {
|
|||
getEntrySlug,
|
||||
getEntryType,
|
||||
getExtGlob,
|
||||
type ContentLookupMap,
|
||||
} from './utils.js';
|
||||
|
||||
interface AstroContentVirtualModPluginParams {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { deserializeRouteData } from '../routing/manifest/serialization.js';
|
||||
import type { RouteInfo, SerializedSSRManifest, SSRManifest } from './types.js';
|
||||
import type { RouteInfo, SSRManifest, SerializedSSRManifest } from './types.js';
|
||||
|
||||
export function deserializeManifest(serializedManifest: SerializedSSRManifest): SSRManifest {
|
||||
const routes: RouteInfo[] = [];
|
||||
|
|
|
@ -1,6 +1,15 @@
|
|||
import type { ManifestData, RouteData, SSRManifest } from '../../@types/astro.js';
|
||||
import { normalizeTheLocale } from '../../i18n/index.js';
|
||||
import type { SinglePageBuiltModule } from '../build/types.js';
|
||||
import {
|
||||
REROUTABLE_STATUS_CODES,
|
||||
REROUTE_DIRECTIVE_HEADER,
|
||||
clientAddressSymbol,
|
||||
clientLocalsSymbol,
|
||||
responseSentSymbol,
|
||||
} from '../constants.js';
|
||||
import { getSetCookiesFromResponse } from '../cookies/index.js';
|
||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||
import { consoleLogDestination } from '../logger/console.js';
|
||||
import { AstroIntegrationLogger, Logger } from '../logger/core.js';
|
||||
import {
|
||||
|
@ -11,19 +20,10 @@ import {
|
|||
removeTrailingForwardSlash,
|
||||
} from '../path.js';
|
||||
import { RedirectSinglePageBuiltModule } from '../redirects/index.js';
|
||||
import { RenderContext } from '../render-context.js';
|
||||
import { createAssetLink } from '../render/ssr-element.js';
|
||||
import { matchRoute } from '../routing/match.js';
|
||||
import { AppPipeline } from './pipeline.js';
|
||||
import { normalizeTheLocale } from '../../i18n/index.js';
|
||||
import { RenderContext } from '../render-context.js';
|
||||
import {
|
||||
clientAddressSymbol,
|
||||
clientLocalsSymbol,
|
||||
responseSentSymbol,
|
||||
REROUTABLE_STATUS_CODES,
|
||||
REROUTE_DIRECTIVE_HEADER,
|
||||
} from '../constants.js';
|
||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||
export { deserializeManifest } from './common.js';
|
||||
|
||||
export interface RenderOptions {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import fs from 'node:fs';
|
||||
import { App } from './index.js';
|
||||
import { deserializeManifest } from './common.js';
|
||||
import { createOutgoingHttpHeaders } from './createOutgoingHttpHeaders.js';
|
||||
import type { IncomingMessage, ServerResponse } from 'node:http';
|
||||
import type { RouteData } from '../../@types/astro.js';
|
||||
import { deserializeManifest } from './common.js';
|
||||
import { createOutgoingHttpHeaders } from './createOutgoingHttpHeaders.js';
|
||||
import { App } from './index.js';
|
||||
import type { RenderOptions } from './index.js';
|
||||
import type { SerializedSSRManifest, SSRManifest } from './types.js';
|
||||
import type { SSRManifest, SerializedSSRManifest } from './types.js';
|
||||
|
||||
export { apply as applyPolyfills } from '../polyfill.js';
|
||||
|
||||
|
|
|
@ -2,13 +2,13 @@ import type {
|
|||
Locales,
|
||||
MiddlewareHandler,
|
||||
RouteData,
|
||||
SerializedRouteData,
|
||||
SSRComponentMetadata,
|
||||
SSRLoadedRenderer,
|
||||
SSRResult,
|
||||
SerializedRouteData,
|
||||
} from '../../@types/astro.js';
|
||||
import type { SinglePageBuiltModule } from '../build/types.js';
|
||||
import type { RoutingStrategies } from '../../i18n/utils.js';
|
||||
import type { SinglePageBuiltModule } from '../build/types.js';
|
||||
|
||||
export type ComponentPath = string;
|
||||
|
||||
|
|
|
@ -6,9 +6,9 @@ import type {
|
|||
SSRManifest,
|
||||
SSRResult,
|
||||
} from '../@types/astro.js';
|
||||
import { createI18nMiddleware } from '../i18n/middleware.js';
|
||||
import type { Logger } from './logger/core.js';
|
||||
import { RouteCache } from './render/route-cache.js';
|
||||
import { createI18nMiddleware } from '../i18n/middleware.js';
|
||||
|
||||
/**
|
||||
* The `Pipeline` represents the static parts of rendering that do not change between requests.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { bgGreen, black, blue, bold, dim, green, magenta, red } from 'kleur/colors';
|
||||
import fs from 'node:fs';
|
||||
import os from 'node:os';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { bgGreen, black, blue, bold, dim, green, magenta, red } from 'kleur/colors';
|
||||
import PQueue from 'p-queue';
|
||||
import type { OutputAsset, OutputChunk } from 'rollup';
|
||||
import type {
|
||||
|
@ -21,7 +21,7 @@ import {
|
|||
getStaticImageList,
|
||||
prepareAssetsGenerationEnv,
|
||||
} from '../../assets/build/generate.js';
|
||||
import { hasPrerenderedPages, type BuildInternals } from '../../core/build/internal.js';
|
||||
import { type BuildInternals, hasPrerenderedPages } from '../../core/build/internal.js';
|
||||
import {
|
||||
isRelativePath,
|
||||
joinPaths,
|
||||
|
@ -29,9 +29,11 @@ import {
|
|||
removeLeadingForwardSlash,
|
||||
removeTrailingForwardSlash,
|
||||
} from '../../core/path.js';
|
||||
import { toRoutingStrategy } from '../../i18n/utils.js';
|
||||
import { runHookBuildGenerated } from '../../integrations/index.js';
|
||||
import { getOutputDirectory, isServerLikeOutput } from '../../prerender/utils.js';
|
||||
import type { SSRManifestI18n } from '../app/types.js';
|
||||
import { NoPrerenderedRoutesWithDomains } from '../errors/errors-data.js';
|
||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||
import { routeIsFallback } from '../redirects/helpers.js';
|
||||
import {
|
||||
|
@ -39,11 +41,11 @@ import {
|
|||
getRedirectLocationOrThrow,
|
||||
routeIsRedirect,
|
||||
} from '../redirects/index.js';
|
||||
import { RenderContext } from '../render-context.js';
|
||||
import { callGetStaticPaths } from '../render/route-cache.js';
|
||||
import { createRequest } from '../request.js';
|
||||
import { matchRoute } from '../routing/match.js';
|
||||
import { getOutputFilename } from '../util.js';
|
||||
import { BuildPipeline } from './pipeline.js';
|
||||
import { getOutDirWithinCwd, getOutFile, getOutFolder } from './common.js';
|
||||
import {
|
||||
cssOrder,
|
||||
|
@ -51,6 +53,7 @@ import {
|
|||
getPageDataByComponent,
|
||||
mergeInlineCss,
|
||||
} from './internal.js';
|
||||
import { BuildPipeline } from './pipeline.js';
|
||||
import type {
|
||||
PageBuildData,
|
||||
SinglePageBuiltModule,
|
||||
|
@ -58,9 +61,6 @@ import type {
|
|||
StylesheetAsset,
|
||||
} from './types.js';
|
||||
import { getTimeStat, shouldAppendForwardSlash } from './util.js';
|
||||
import { NoPrerenderedRoutesWithDomains } from '../errors/errors-data.js';
|
||||
import { RenderContext } from '../render-context.js';
|
||||
import { toRoutingStrategy } from '../../i18n/utils.js';
|
||||
|
||||
function createEntryURL(filePath: string, outFolder: URL) {
|
||||
return new URL('./' + filePath + `?time=${Date.now()}`, outFolder);
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { blue, bold, green } from 'kleur/colors';
|
||||
import fs from 'node:fs';
|
||||
import { performance } from 'node:perf_hooks';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { blue, bold, green } from 'kleur/colors';
|
||||
import type * as vite from 'vite';
|
||||
import type {
|
||||
AstroConfig,
|
||||
|
@ -28,11 +28,11 @@ import type { Logger } from '../logger/core.js';
|
|||
import { levels, timerMessage } from '../logger/core.js';
|
||||
import { apply as applyPolyfill } from '../polyfill.js';
|
||||
import { createRouteManifest } from '../routing/index.js';
|
||||
import { ensureProcessNodeEnv } from '../util.js';
|
||||
import { collectPagesData } from './page-data.js';
|
||||
import { staticBuild, viteBuild } from './static-build.js';
|
||||
import type { StaticBuildOptions } from './types.js';
|
||||
import { getTimeStat } from './util.js';
|
||||
import { ensureProcessNodeEnv } from '../util.js';
|
||||
|
||||
export interface BuildOptions {
|
||||
/**
|
||||
|
|
|
@ -10,9 +10,9 @@ import {
|
|||
createStylesheetElementSet,
|
||||
} from '../render/ssr-element.js';
|
||||
import {
|
||||
getPageDataByComponent,
|
||||
type BuildInternals,
|
||||
cssOrder,
|
||||
getPageDataByComponent,
|
||||
mergeInlineCss,
|
||||
} from './internal.js';
|
||||
import {
|
||||
|
|
|
@ -2,9 +2,9 @@ import { createHash } from 'node:crypto';
|
|||
import fsMod from 'node:fs';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import pLimit from 'p-limit';
|
||||
import { normalizePath, type Plugin as VitePlugin } from 'vite';
|
||||
import { type Plugin as VitePlugin, normalizePath } from 'vite';
|
||||
import { CONTENT_RENDER_FLAG, PROPAGATED_ASSET_FLAG } from '../../../content/consts.js';
|
||||
import { hasContentFlag, type ContentLookupMap } from '../../../content/utils.js';
|
||||
import { type ContentLookupMap, hasContentFlag } from '../../../content/utils.js';
|
||||
import {
|
||||
generateContentEntryFile,
|
||||
generateLookupMap,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import type { GetModuleInfo } from 'rollup';
|
||||
import type { BuildOptions, ResolvedConfig, Plugin as VitePlugin } from 'vite';
|
||||
import type { BuildOptions, Plugin as VitePlugin, ResolvedConfig } from 'vite';
|
||||
import { isBuildableCSSRequest } from '../../../vite-plugin-astro-server/util.js';
|
||||
import type { BuildInternals } from '../internal.js';
|
||||
import type { AstroBuildPlugin, BuildTarget } from '../plugin.js';
|
||||
|
|
|
@ -1,7 +1,9 @@
|
|||
import glob from 'fast-glob';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import glob from 'fast-glob';
|
||||
import type { OutputChunk } from 'rollup';
|
||||
import { type Plugin as VitePlugin } from 'vite';
|
||||
import { normalizeTheLocale } from '../../../i18n/index.js';
|
||||
import { toRoutingStrategy } from '../../../i18n/utils.js';
|
||||
import { runHookBuildSsr } from '../../../integrations/index.js';
|
||||
import { BEFORE_HYDRATION_SCRIPT_ID, PAGE_SCRIPT_ID } from '../../../vite-plugin-scripts/index.js';
|
||||
import type {
|
||||
|
@ -13,11 +15,9 @@ 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 BuildInternals, cssOrder, mergeInlineCss } from '../internal.js';
|
||||
import type { AstroBuildPlugin } from '../plugin.js';
|
||||
import type { StaticBuildOptions } from '../types.js';
|
||||
import { normalizeTheLocale } from '../../../i18n/index.js';
|
||||
import { toRoutingStrategy } from '../../../i18n/utils.js';
|
||||
|
||||
const manifestReplace = '@@ASTRO_MANIFEST_REPLACE@@';
|
||||
const replaceExp = new RegExp(`['"]${manifestReplace}['"]`, 'g');
|
||||
|
|
|
@ -2,7 +2,7 @@ import { extname } from 'node:path';
|
|||
import type { Plugin as VitePlugin } from 'vite';
|
||||
import { routeIsRedirect } from '../../redirects/index.js';
|
||||
import { addRollupInput } from '../add-rollup-input.js';
|
||||
import { eachPageFromAllPages, type BuildInternals } from '../internal.js';
|
||||
import { type BuildInternals, eachPageFromAllPages } from '../internal.js';
|
||||
import type { AstroBuildPlugin } from '../plugin.js';
|
||||
import type { StaticBuildOptions } from '../types.js';
|
||||
import { RENDERERS_MODULE_ID } from './plugin-renderers.js';
|
||||
|
|
|
@ -11,10 +11,10 @@ import { eachPageFromAllPages } from '../internal.js';
|
|||
import type { AstroBuildPlugin } from '../plugin.js';
|
||||
import type { StaticBuildOptions } from '../types.js';
|
||||
import { SSR_MANIFEST_VIRTUAL_MODULE_ID } from './plugin-manifest.js';
|
||||
import { MIDDLEWARE_MODULE_ID } from './plugin-middleware.js';
|
||||
import { ASTRO_PAGE_MODULE_ID } from './plugin-pages.js';
|
||||
import { RENDERERS_MODULE_ID } from './plugin-renderers.js';
|
||||
import { getPathFromVirtualModulePageName, getVirtualModulePageNameFromPath } from './util.js';
|
||||
import { MIDDLEWARE_MODULE_ID } from './plugin-middleware.js';
|
||||
|
||||
export const SSR_VIRTUAL_MODULE_ID = '@astrojs-ssr-virtual-entry';
|
||||
export const RESOLVED_SSR_VIRTUAL_MODULE_ID = '\0' + SSR_VIRTUAL_MODULE_ID;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { extname } from 'node:path';
|
||||
import type { BuildOptions, Rollup, Plugin as VitePlugin } from 'vite';
|
||||
import type { BuildOptions, Plugin as VitePlugin, Rollup } from 'vite';
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||
type OutputOptionsHook = Extract<VitePlugin['outputOptions'], Function>;
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
import fs from 'node:fs';
|
||||
import path, { extname } from 'node:path';
|
||||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||
import { teardown } from '@astrojs/compiler';
|
||||
import * as eslexer from 'es-module-lexer';
|
||||
import glob from 'fast-glob';
|
||||
import { bgGreen, bgMagenta, black, green } from 'kleur/colors';
|
||||
import fs from 'node:fs';
|
||||
import path, { extname } from 'node:path';
|
||||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||
import * as vite from 'vite';
|
||||
import type { RouteData } from '../../@types/astro.js';
|
||||
import { PROPAGATED_ASSET_FLAG } from '../../content/consts.js';
|
||||
import { hasAnyContentFlag } from '../../content/utils.js';
|
||||
import {
|
||||
type BuildInternals,
|
||||
createBuildInternals,
|
||||
eachPageData,
|
||||
type BuildInternals,
|
||||
} from '../../core/build/internal.js';
|
||||
import { emptyDir, removeEmptyDirs } from '../../core/fs/index.js';
|
||||
import { appendForwardSlash, prependForwardSlash, removeFileExtension } from '../../core/path.js';
|
||||
|
@ -25,7 +25,7 @@ import { routeIsRedirect } from '../redirects/index.js';
|
|||
import { getOutDirWithinCwd } from './common.js';
|
||||
import { generatePages } from './generate.js';
|
||||
import { trackPageData } from './internal.js';
|
||||
import { createPluginContainer, type AstroBuildPluginContainer } from './plugin.js';
|
||||
import { type AstroBuildPluginContainer, createPluginContainer } from './plugin.js';
|
||||
import { registerAllPlugins } from './plugins/index.js';
|
||||
import { RESOLVED_SSR_MANIFEST_VIRTUAL_MODULE_ID } from './plugins/plugin-manifest.js';
|
||||
import { ASTRO_PAGE_RESOLVED_MODULE_ID } from './plugins/plugin-pages.js';
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import { build } from 'esbuild';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { build } from 'esbuild';
|
||||
|
||||
/**
|
||||
* Build a client directive entrypoint into code that can directly run in a `<script>` tag.
|
||||
|
|
|
@ -2,15 +2,15 @@ import type { TransformResult } from '@astrojs/compiler';
|
|||
import type { ResolvedConfig } from 'vite';
|
||||
import type { AstroConfig } from '../../@types/astro.js';
|
||||
|
||||
import { transform } from '@astrojs/compiler';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { transform } from '@astrojs/compiler';
|
||||
import { normalizePath } from 'vite';
|
||||
import type { AstroPreferences } from '../../preferences/index.js';
|
||||
import type { AstroError } from '../errors/errors.js';
|
||||
import { AggregateError, CompilerError } from '../errors/errors.js';
|
||||
import { AstroErrorData } from '../errors/index.js';
|
||||
import { resolvePath } from '../util.js';
|
||||
import { createStylePreprocessor } from './style.js';
|
||||
import type { AstroPreferences } from '../../preferences/index.js';
|
||||
|
||||
export interface CompileProps {
|
||||
astroConfig: AstroConfig;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { TransformOptions } from '@astrojs/compiler';
|
||||
import fs from 'node:fs';
|
||||
import { normalizePath, preprocessCSS, type ResolvedConfig } from 'vite';
|
||||
import type { TransformOptions } from '@astrojs/compiler';
|
||||
import { type ResolvedConfig, normalizePath, preprocessCSS } from 'vite';
|
||||
import { AstroErrorData, CSSError, positionAt } from '../errors/index.js';
|
||||
import type { CompileCssResult } from './compile.js';
|
||||
|
||||
|
|
|
@ -7,10 +7,10 @@ import type {
|
|||
CLIFlags,
|
||||
} from '../../@types/astro.js';
|
||||
|
||||
import * as colors from 'kleur/colors';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import * as colors from 'kleur/colors';
|
||||
import { ZodError } from 'zod';
|
||||
import { eventConfigError, telemetry } from '../../events/index.js';
|
||||
import { trackAstroConfigZodError } from '../errors/errors.js';
|
||||
|
|
|
@ -5,7 +5,7 @@ import type {
|
|||
ShikiConfig,
|
||||
} from '@astrojs/markdown-remark';
|
||||
import { markdownConfigDefaults } from '@astrojs/markdown-remark';
|
||||
import { bundledThemes, type BuiltinTheme } from 'shikiji';
|
||||
import { type BuiltinTheme, bundledThemes } from 'shikiji';
|
||||
import type { AstroUserConfig, ViteUserConfig } from '../../@types/astro.js';
|
||||
|
||||
import type { OutgoingHttpHeaders } from 'node:http';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import yaml from 'js-yaml';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath, pathToFileURL } from 'node:url';
|
||||
import yaml from 'js-yaml';
|
||||
import type { AstroConfig, AstroSettings } from '../../@types/astro.js';
|
||||
import { getContentPaths } from '../../content/index.js';
|
||||
import createPreferences from '../../preferences/index.js';
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import { join } from 'node:path';
|
||||
import {
|
||||
TSConfckParseError,
|
||||
find,
|
||||
parse,
|
||||
type TSConfckParseOptions,
|
||||
type TSConfckParseResult,
|
||||
find,
|
||||
parse,
|
||||
} from 'tsconfck';
|
||||
import type { CompilerOptions, TypeAcquisition } from 'typescript';
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type fsType from 'node:fs';
|
||||
import { pathToFileURL } from 'node:url';
|
||||
import { createServer, type ViteDevServer } from 'vite';
|
||||
import { type ViteDevServer, createServer } from 'vite';
|
||||
import loadFallbackPlugin from '../../vite-plugin-load-fallback/index.js';
|
||||
import { debug } from '../logger/core.js';
|
||||
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
import { green } from 'kleur/colors';
|
||||
import type * as vite from 'vite';
|
||||
import fs from 'node:fs';
|
||||
import type http from 'node:http';
|
||||
import type { AddressInfo } from 'node:net';
|
||||
import { green } from 'kleur/colors';
|
||||
import { performance } from 'perf_hooks';
|
||||
import type * as vite from 'vite';
|
||||
import type { AstroInlineConfig } from '../../@types/astro.js';
|
||||
import { attachContentServerListeners } from '../../content/index.js';
|
||||
import { telemetry } from '../../events/index.js';
|
||||
import * as msg from '../messages.js';
|
||||
import { ensureProcessNodeEnv } from '../util.js';
|
||||
import { startContainer } from './container.js';
|
||||
import { createContainerWithAutomaticRestart } from './restart.js';
|
||||
import { ensureProcessNodeEnv } from '../util.js';
|
||||
|
||||
export interface DevServer {
|
||||
address: AddressInfo;
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import type { APIContext, Locales, Params } from '../../@types/astro.js';
|
||||
import { ASTRO_VERSION, clientAddressSymbol, clientLocalsSymbol } from '../constants.js';
|
||||
import type { AstroCookies } from '../cookies/index.js';
|
||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||
import {
|
||||
type RoutingStrategies,
|
||||
computeCurrentLocale,
|
||||
computePreferredLocale,
|
||||
computePreferredLocaleList,
|
||||
type RoutingStrategies,
|
||||
} from '../../i18n/utils.js';
|
||||
import { ASTRO_VERSION, clientAddressSymbol, clientLocalsSymbol } from '../constants.js';
|
||||
import type { AstroCookies } from '../cookies/index.js';
|
||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||
|
||||
type CreateAPIContext = {
|
||||
request: Request;
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { escape } from 'html-escaper';
|
||||
import { bold, underline } from 'kleur/colors';
|
||||
import * as fs from 'node:fs';
|
||||
import { isAbsolute, join } from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { escape } from 'html-escaper';
|
||||
import { bold, underline } from 'kleur/colors';
|
||||
import stripAnsi from 'strip-ansi';
|
||||
import type { ESBuildTransformResult } from 'vite';
|
||||
import { normalizePath } from 'vite';
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { getEventPrefix, levels, type LogMessage, type LogWritable } from './core.js';
|
||||
import { type LogMessage, type LogWritable, getEventPrefix, levels } from './core.js';
|
||||
|
||||
export const consoleLogDestination: LogWritable<LogMessage> = {
|
||||
write(event: LogMessage) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import debugPackage from 'debug';
|
||||
import type { Writable } from 'node:stream';
|
||||
import { getEventPrefix, levels, type LogMessage, type LogWritable } from './core.js';
|
||||
import debugPackage from 'debug';
|
||||
import { type LogMessage, type LogWritable, getEventPrefix, levels } from './core.js';
|
||||
|
||||
type ConsoleStream = Writable & {
|
||||
fd: 1 | 2;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { fileURLToPath } from 'url';
|
||||
import stripAnsi from 'strip-ansi';
|
||||
import type { Logger as ViteLogger, Rollup, LogLevel } from 'vite';
|
||||
import type { LogLevel, Logger as ViteLogger, Rollup } from 'vite';
|
||||
import { isAstroError } from '../errors/errors.js';
|
||||
import { isLogLevelEnabled, type Logger as AstroLogger } from './core.js';
|
||||
import { serverShortcuts as formatServerShortcuts } from '../messages.js';
|
||||
import { type Logger as AstroLogger, isLogLevelEnabled } from './core.js';
|
||||
|
||||
const PKG_PREFIX = fileURLToPath(new URL('../../../', import.meta.url));
|
||||
const E2E_PREFIX = fileURLToPath(new URL('../../../e2e', import.meta.url));
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import type { APIContext, MiddlewareHandler, Params } from '../../@types/astro.js';
|
||||
import { AstroCookies } from '../cookies/index.js';
|
||||
import { sequence } from './sequence.js';
|
||||
import { ASTRO_VERSION } from '../constants.js';
|
||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||
import {
|
||||
computeCurrentLocale,
|
||||
computePreferredLocale,
|
||||
computePreferredLocaleList,
|
||||
} from '../../i18n/utils.js';
|
||||
import { ASTRO_VERSION } from '../constants.js';
|
||||
import { AstroCookies } from '../cookies/index.js';
|
||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||
import { sequence } from './sequence.js';
|
||||
|
||||
const clientAddressSymbol = Symbol.for('astro.clientAddress');
|
||||
const clientLocalsSymbol = Symbol.for('astro.locals');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import type { ModuleLoader } from '../module-loader/index.js';
|
||||
import { MIDDLEWARE_MODULE_ID } from './vite-plugin.js';
|
||||
import { MiddlewareCantBeLoaded } from '../errors/errors-data.js';
|
||||
import { AstroError } from '../errors/index.js';
|
||||
import type { ModuleLoader } from '../module-loader/index.js';
|
||||
import { MIDDLEWARE_MODULE_ID } from './vite-plugin.js';
|
||||
|
||||
/**
|
||||
* It accepts a module loader and the astro settings, and it attempts to load the middlewares defined in the configuration.
|
||||
|
|
|
@ -9,10 +9,10 @@ import { runHookConfigDone, runHookConfigSetup } from '../../integrations/index.
|
|||
import { resolveConfig } from '../config/config.js';
|
||||
import { createNodeLogger } from '../config/logging.js';
|
||||
import { createSettings } from '../config/settings.js';
|
||||
import { apply as applyPolyfills } from '../polyfill.js';
|
||||
import { ensureProcessNodeEnv } from '../util.js';
|
||||
import createStaticPreviewServer from './static-preview-server.js';
|
||||
import { getResolvedHostForHttpServer } from './util.js';
|
||||
import { ensureProcessNodeEnv } from '../util.js';
|
||||
import { apply as applyPolyfills } from '../polyfill.js';
|
||||
|
||||
/**
|
||||
* Starts a local server to serve your static dist/ directory. This command is useful for previewing
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import type http from 'node:http';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { performance } from 'perf_hooks';
|
||||
import { preview, type PreviewServer as VitePreviewServer } from 'vite';
|
||||
import { type PreviewServer as VitePreviewServer, preview } from 'vite';
|
||||
import type { AstroSettings } from '../../@types/astro.js';
|
||||
import type { Logger } from '../logger/core.js';
|
||||
import * as msg from '../messages.js';
|
||||
|
|
|
@ -4,12 +4,12 @@ import type {
|
|||
MiddlewareHandler,
|
||||
RouteData,
|
||||
} from '../@types/astro.js';
|
||||
import {
|
||||
computeCurrentLocale,
|
||||
computePreferredLocale,
|
||||
computePreferredLocaleList,
|
||||
} from '../i18n/utils.js';
|
||||
import { renderEndpoint } from '../runtime/server/endpoint.js';
|
||||
import { attachCookiesToResponse } from './cookies/index.js';
|
||||
import { callMiddleware } from './middleware/callMiddleware.js';
|
||||
import { sequence } from './middleware/index.js';
|
||||
import { AstroCookies } from './cookies/index.js';
|
||||
import { createResult } from './render/index.js';
|
||||
import { renderPage } from '../runtime/server/index.js';
|
||||
import {
|
||||
ASTRO_VERSION,
|
||||
|
@ -17,14 +17,14 @@ import {
|
|||
clientAddressSymbol,
|
||||
clientLocalsSymbol,
|
||||
} from './constants.js';
|
||||
import { getParams, getProps, type Pipeline } from './render/index.js';
|
||||
import { attachCookiesToResponse } from './cookies/index.js';
|
||||
import { AstroCookies } from './cookies/index.js';
|
||||
import { AstroError, AstroErrorData } from './errors/index.js';
|
||||
import {
|
||||
computeCurrentLocale,
|
||||
computePreferredLocale,
|
||||
computePreferredLocaleList,
|
||||
} from '../i18n/utils.js';
|
||||
import { callMiddleware } from './middleware/callMiddleware.js';
|
||||
import { sequence } from './middleware/index.js';
|
||||
import { renderRedirect } from './redirects/render.js';
|
||||
import { createResult } from './render/index.js';
|
||||
import { type Pipeline, getParams, getProps } from './render/index.js';
|
||||
|
||||
export class RenderContext {
|
||||
private constructor(
|
||||
|
|
|
@ -7,19 +7,19 @@ import type {
|
|||
SSRLoadedRenderer,
|
||||
SSRResult,
|
||||
} 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';
|
||||
import { AstroCookies } from '../cookies/index.js';
|
||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||
import type { Logger } from '../logger/core.js';
|
||||
import {
|
||||
type RoutingStrategies,
|
||||
computeCurrentLocale,
|
||||
computePreferredLocale,
|
||||
computePreferredLocaleList,
|
||||
type RoutingStrategies,
|
||||
} from '../../i18n/utils.js';
|
||||
import { type ComponentSlots, renderSlotToString } from '../../runtime/server/index.js';
|
||||
import { renderJSX } from '../../runtime/server/jsx.js';
|
||||
import { chunkToString } from '../../runtime/server/render/index.js';
|
||||
import { clientAddressSymbol, responseSentSymbol } from '../constants.js';
|
||||
import { AstroCookies } from '../cookies/index.js';
|
||||
import { AstroError, AstroErrorData } from '../errors/index.js';
|
||||
import type { Logger } from '../logger/core.js';
|
||||
|
||||
export interface CreateResultArgs {
|
||||
/**
|
||||
|
|
|
@ -8,11 +8,12 @@ import type {
|
|||
} from '../../../@types/astro.js';
|
||||
import type { Logger } from '../../logger/core.js';
|
||||
|
||||
import { bold } from 'kleur/colors';
|
||||
import { createRequire } from 'module';
|
||||
import nodeFs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { bold } from 'kleur/colors';
|
||||
import { toRoutingStrategy } from '../../../i18n/utils.js';
|
||||
import { getPrerenderDefault } from '../../../prerender/utils.js';
|
||||
import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from '../../constants.js';
|
||||
import { MissingIndexForInternationalization } from '../../errors/errors-data.js';
|
||||
|
@ -20,7 +21,6 @@ import { AstroError } from '../../errors/index.js';
|
|||
import { removeLeadingForwardSlash, slash } from '../../path.js';
|
||||
import { resolvePages } from '../../util.js';
|
||||
import { getRouteGenerator } from './generator.js';
|
||||
import { toRoutingStrategy } from '../../../i18n/utils.js';
|
||||
const require = createRequire(import.meta.url);
|
||||
|
||||
interface Item {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import {
|
||||
createShikiHighlighter,
|
||||
type ShikiConfig,
|
||||
type ShikiHighlighter,
|
||||
createShikiHighlighter,
|
||||
} from '@astrojs/markdown-remark';
|
||||
|
||||
// Caches Promise<ShikiHighlighter> for reuse when the same theme and langs are provided
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { dim } from 'kleur/colors';
|
||||
import fsMod from 'node:fs';
|
||||
import { performance } from 'node:perf_hooks';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { createServer, type HMRPayload } from 'vite';
|
||||
import { dim } from 'kleur/colors';
|
||||
import { type HMRPayload, createServer } from 'vite';
|
||||
import type { AstroInlineConfig, AstroSettings } from '../../@types/astro.js';
|
||||
import { createContentTypesGenerator } from '../../content/index.js';
|
||||
import { globalContentConfigObserver } from '../../content/utils.js';
|
||||
|
@ -15,11 +15,11 @@ import { resolveConfig } from '../config/config.js';
|
|||
import { createNodeLogger } from '../config/logging.js';
|
||||
import { createSettings } from '../config/settings.js';
|
||||
import { createVite } from '../create-vite.js';
|
||||
import { collectErrorMetadata } from '../errors/dev/utils.js';
|
||||
import { AstroError, AstroErrorData, createSafeError, isAstroError } from '../errors/index.js';
|
||||
import type { Logger } from '../logger/core.js';
|
||||
import { ensureProcessNodeEnv } from '../util.js';
|
||||
import { formatErrorMessage } from '../messages.js';
|
||||
import { collectErrorMetadata } from '../errors/dev/utils.js';
|
||||
import { ensureProcessNodeEnv } from '../util.js';
|
||||
|
||||
export type ProcessExit = 0 | 1;
|
||||
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import { appendForwardSlash, joinPaths } from '@astrojs/internal-helpers/path';
|
||||
import type { APIContext, Locales, MiddlewareHandler, SSRManifest } from '../@types/astro.js';
|
||||
import { getPathByLocale, normalizeTheLocale } from './index.js';
|
||||
import { shouldAppendForwardSlash } from '../core/build/util.js';
|
||||
import type { SSRManifestI18n } from '../core/app/types.js';
|
||||
import { shouldAppendForwardSlash } from '../core/build/util.js';
|
||||
import { ROUTE_TYPE_HEADER } from '../core/constants.js';
|
||||
import { getPathByLocale, normalizeTheLocale } from './index.js';
|
||||
|
||||
// Checks if the pathname has any locale, exception for the defaultLocale, which is ignored on purpose.
|
||||
function pathnameHasLocale(pathname: string, locales: Locales): boolean {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import { bold } from 'kleur/colors';
|
||||
import fs from 'node:fs';
|
||||
import type { AddressInfo } from 'node:net';
|
||||
import { fileURLToPath } from 'node:url';
|
||||
import { bold } from 'kleur/colors';
|
||||
import type { InlineConfig, ViteDevServer } from 'vite';
|
||||
import type {
|
||||
AstroAdapter,
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { Fragment, markHTMLString, Renderer } from '../runtime/server/index.js';
|
||||
import { Fragment, Renderer, markHTMLString } from '../runtime/server/index.js';
|
||||
|
||||
const AstroJSX = 'astro:jsx';
|
||||
const Empty = Symbol('empty');
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import dget from 'dlv';
|
||||
import { dset } from 'dset';
|
||||
import fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import dget from 'dlv';
|
||||
import { dset } from 'dset';
|
||||
|
||||
export class PreferenceStore {
|
||||
private file: string;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import type { DevToolbarApp, DevToolbarMetadata } from '../../../../@types/astro.js';
|
||||
import { isDefinedIcon, type Icon } from '../ui-library/icons.js';
|
||||
import { type Icon, isDefinedIcon } from '../ui-library/icons.js';
|
||||
import { colorForIntegration, iconForIntegration } from './utils/icons.js';
|
||||
import { closeOnOutsideClick, createWindowElement } from './utils/window.js';
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
import type { DevToolbarApp } from '../../../../@types/astro.js';
|
||||
import { settings, type Settings } from '../settings.js';
|
||||
import { type Settings, settings } from '../settings.js';
|
||||
import { closeOnOutsideClick, createWindowElement } from './utils/window.js';
|
||||
|
||||
interface SettingRow {
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/* eslint-disable no-console */
|
||||
import type { DevToolbarApp as DevToolbarAppDefinition } from '../../../@types/astro.js';
|
||||
import { settings } from './settings.js';
|
||||
import { getIconElement, isDefinedIcon, type Icon } from './ui-library/icons.js';
|
||||
import { type Icon, getIconElement, isDefinedIcon } from './ui-library/icons.js';
|
||||
|
||||
export type DevToolbarApp = DevToolbarAppDefinition & {
|
||||
builtIn: boolean;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { getIconElement, isDefinedIcon, type Icon } from './icons.js';
|
||||
import { type Icon, getIconElement, isDefinedIcon } from './icons.js';
|
||||
|
||||
export class DevToolbarHighlight extends HTMLElement {
|
||||
icon?: Icon | undefined | null;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { getIconElement, isDefinedIcon, type Icon } from './icons.js';
|
||||
import { type Icon, getIconElement, isDefinedIcon } from './icons.js';
|
||||
|
||||
export class DevToolbarIcon extends HTMLElement {
|
||||
_icon: Icon | undefined = undefined;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { getIconElement, isDefinedIcon, type Icon } from './icons.js';
|
||||
import { type Icon, getIconElement, isDefinedIcon } from './icons.js';
|
||||
|
||||
export interface DevToolbarTooltipSection {
|
||||
title?: string;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { bold } from 'kleur/colors';
|
||||
import { REROUTABLE_STATUS_CODES, REROUTE_DIRECTIVE_HEADER } from '../../core/constants.js';
|
||||
import type { APIContext, EndpointHandler } from '../../@types/astro.js';
|
||||
import { REROUTABLE_STATUS_CODES, REROUTE_DIRECTIVE_HEADER } from '../../core/constants.js';
|
||||
import type { Logger } from '../../core/logger/core.js';
|
||||
|
||||
/** Renders an endpoint request to completion, returning the body. */
|
||||
|
|
|
@ -41,7 +41,7 @@ export type {
|
|||
export { createTransitionScope, renderTransition } from './transition.js';
|
||||
|
||||
import { markHTMLString } from './escape.js';
|
||||
import { addAttribute, Renderer } from './render/index.js';
|
||||
import { Renderer, addAttribute } from './render/index.js';
|
||||
|
||||
export function mergeSlots(...slotted: unknown[]) {
|
||||
const slots: Record<string, () => any> = {};
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* eslint-disable no-console */
|
||||
import type { SSRResult } from '../../@types/astro.js';
|
||||
import { AstroJSX, isVNode, type AstroVNode } from '../../jsx-runtime/index.js';
|
||||
import { AstroJSX, type AstroVNode, isVNode } from '../../jsx-runtime/index.js';
|
||||
import {
|
||||
HTMLString,
|
||||
escapeHTML,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { escapeHTML, isHTMLString, markHTMLString } from '../escape.js';
|
||||
import { isAstroComponentInstance, isRenderTemplateResult } from './astro/index.js';
|
||||
import { isRenderInstance, type RenderDestination } from './common.js';
|
||||
import { type RenderDestination, isRenderInstance } from './common.js';
|
||||
import { SlotString } from './slot.js';
|
||||
import { renderToBufferDestination } from './util.js';
|
||||
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import type { RouteData, SSRResult } from '../../../../@types/astro.js';
|
||||
import { AstroError, AstroErrorData } from '../../../../core/errors/index.js';
|
||||
import { chunkToByteArray, chunkToString, encoder, type RenderDestination } from '../common.js';
|
||||
import { type RenderDestination, chunkToByteArray, chunkToString, encoder } from '../common.js';
|
||||
import { promiseWithResolvers } from '../util.js';
|
||||
import type { AstroComponentFactory } from './factory.js';
|
||||
import { isHeadAndContent } from './head-and-content.js';
|
||||
import { isRenderTemplateResult } from './render-template.js';
|
||||
import { promiseWithResolvers } from '../util.js';
|
||||
|
||||
const DOCTYPE_EXP = /<!doctype html/i;
|
||||
|
||||
|
|
|
@ -4,14 +4,14 @@ import type { RenderInstruction } from './instruction.js';
|
|||
import type { HTMLBytes, HTMLString } from '../escape.js';
|
||||
import { markHTMLString } from '../escape.js';
|
||||
import {
|
||||
type PrescriptType,
|
||||
determineIfNeedsHydrationScript,
|
||||
determinesIfNeedsDirectiveScript,
|
||||
getPrescripts,
|
||||
type PrescriptType,
|
||||
} from '../scripts.js';
|
||||
import { renderAllHeadContent } from './head.js';
|
||||
import { isRenderInstruction } from './instruction.js';
|
||||
import { isSlotString, type SlotString } from './slot.js';
|
||||
import { type SlotString, isSlotString } from './slot.js';
|
||||
|
||||
/**
|
||||
* Possible chunk types to be written to the destination, and it'll
|
||||
|
|
|
@ -4,7 +4,7 @@ import type {
|
|||
SSRLoadedRenderer,
|
||||
SSRResult,
|
||||
} from '../../../@types/astro.js';
|
||||
import { createRenderInstruction, type RenderInstruction } from './instruction.js';
|
||||
import { type RenderInstruction, createRenderInstruction } from './instruction.js';
|
||||
|
||||
import { clsx } from 'clsx';
|
||||
import { AstroError, AstroErrorData } from '../../../core/errors/index.js';
|
||||
|
@ -14,20 +14,20 @@ import { extractDirectives, generateHydrateScript } from '../hydration.js';
|
|||
import { serializeProps } from '../serialize.js';
|
||||
import { shorthash } from '../shorthash.js';
|
||||
import { isPromise } from '../util.js';
|
||||
import { isAstroComponentFactory, type AstroComponentFactory } from './astro/factory.js';
|
||||
import { type AstroComponentFactory, isAstroComponentFactory } from './astro/factory.js';
|
||||
import { renderTemplate } from './astro/index.js';
|
||||
import { createAstroComponentInstance } from './astro/instance.js';
|
||||
|
||||
import {
|
||||
Fragment,
|
||||
Renderer,
|
||||
chunkToString,
|
||||
type RenderDestination,
|
||||
type RenderInstance,
|
||||
Renderer,
|
||||
chunkToString,
|
||||
} from './common.js';
|
||||
import { componentIsHTMLElement, renderHTMLElement } from './dom.js';
|
||||
import { maybeRenderHead } from './head.js';
|
||||
import { renderSlotToString, renderSlots, type ComponentSlots } from './slot.js';
|
||||
import { type ComponentSlots, renderSlotToString, renderSlots } from './slot.js';
|
||||
import { formatList, internalSpreadAttributes, renderElement, voidElementNames } from './util.js';
|
||||
|
||||
const needsHeadRenderingSymbol = Symbol.for('astro.needsHeadRendering');
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import type { RouteData, SSRResult } from '../../../@types/astro.js';
|
||||
import { renderComponentToString, type NonAstroPageComponent } from './component.js';
|
||||
import { type NonAstroPageComponent, renderComponentToString } from './component.js';
|
||||
import type { AstroComponentFactory } from './index.js';
|
||||
|
||||
import { isAstroComponentFactory } from './astro/index.js';
|
||||
import { renderToReadableStream, renderToString, renderToAsyncIterable } from './astro/render.js';
|
||||
import { renderToAsyncIterable, renderToReadableStream, renderToString } from './astro/render.js';
|
||||
import { encoder } from './common.js';
|
||||
import { isNode } from './util.js';
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import type { RenderInstruction } from './instruction.js';
|
|||
|
||||
import { HTMLString, markHTMLString } from '../escape.js';
|
||||
import { renderChild } from './any.js';
|
||||
import { chunkToString, type RenderDestination, type RenderInstance } from './common.js';
|
||||
import { type RenderDestination, type RenderInstance, chunkToString } from './common.js';
|
||||
|
||||
type RenderTemplateResult = ReturnType<typeof renderTemplate>;
|
||||
export type ComponentSlots = Record<string, ComponentSlotValue>;
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import type { SSRResult } from '../../@types/astro.js';
|
||||
import islandScript from './astro-island.prebuilt.js';
|
||||
import islandScriptDev from './astro-island.prebuilt-dev.js';
|
||||
import islandScript from './astro-island.prebuilt.js';
|
||||
|
||||
const ISLAND_STYLES = `<style>astro-island,astro-slot,astro-static-slot{display:contents}</style>`;
|
||||
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import cssesc from 'cssesc';
|
||||
import type {
|
||||
SSRResult,
|
||||
TransitionAnimation,
|
||||
|
@ -7,7 +8,6 @@ import type {
|
|||
} from '../../@types/astro.js';
|
||||
import { fade, slide } from '../../transitions/index.js';
|
||||
import { markHTMLString } from './escape.js';
|
||||
import cssesc from 'cssesc';
|
||||
|
||||
const transitionNameMap = new WeakMap<SSRResult, number>();
|
||||
function incrementTransitionNumber(result: SSRResult) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import * as I18nInternals from '../i18n/index.js';
|
||||
import type { I18nInternalConfig } from '../i18n/vite-plugin-i18n.js';
|
||||
import { toRoutingStrategy } from '../i18n/utils.js';
|
||||
import type { I18nInternalConfig } from '../i18n/vite-plugin-i18n.js';
|
||||
export { normalizeTheLocale, toCodes, toPaths } from '../i18n/index.js';
|
||||
|
||||
const { trailingSlash, format, site, i18n, isBuild } =
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import type * as vite from 'vite';
|
||||
import type { AstroSettings } from '../@types/astro.js';
|
||||
|
||||
import { bold } from 'kleur/colors';
|
||||
import * as fs from 'node:fs';
|
||||
import path from 'node:path';
|
||||
import { appendForwardSlash } from '@astrojs/internal-helpers/path';
|
||||
import { bold } from 'kleur/colors';
|
||||
import type { Logger } from '../core/logger/core.js';
|
||||
import notFoundTemplate, { subpathNotUsedTemplate } from '../template/4xx.js';
|
||||
import { writeHtmlResponse } from './response.js';
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import type { ModuleLoader } from '../core/module-loader/index.js';
|
||||
import type { AstroConfig } from '../@types/astro.js';
|
||||
import type { ModuleLoader } from '../core/module-loader/index.js';
|
||||
import type { DevPipeline } from './pipeline.js';
|
||||
|
||||
import { collectErrorMetadata } from '../core/errors/dev/index.js';
|
||||
import { createSafeError, AstroErrorData } from '../core/errors/index.js';
|
||||
import { AstroErrorData, createSafeError } from '../core/errors/index.js';
|
||||
import { formatErrorMessage } from '../core/messages.js';
|
||||
import { eventError, telemetry } from '../events/index.js';
|
||||
|
||||
|
|
|
@ -8,21 +8,21 @@ import type {
|
|||
SSRLoadedRenderer,
|
||||
SSRManifest,
|
||||
} from '../@types/astro.js';
|
||||
import { getInfoOutput } from '../cli/info/index.js';
|
||||
import type { HeadElements } from '../core/base-pipeline.js';
|
||||
import { ASTRO_VERSION } from '../core/constants.js';
|
||||
import { enhanceViteSSRError } from '../core/errors/dev/index.js';
|
||||
import { AggregateError, CSSError, MarkdownError } from '../core/errors/index.js';
|
||||
import type { Logger } from '../core/logger/core.js';
|
||||
import type { ModuleLoader } from '../core/module-loader/index.js';
|
||||
import { Pipeline, loadRenderer } from '../core/render/index.js';
|
||||
import { isPage, resolveIdToUrl, viteID } from '../core/util.js';
|
||||
import { isServerLikeOutput } from '../prerender/utils.js';
|
||||
import { createResolve } from './resolve.js';
|
||||
import { AggregateError, CSSError, MarkdownError } from '../core/errors/index.js';
|
||||
import { enhanceViteSSRError } from '../core/errors/dev/index.js';
|
||||
import type { HeadElements } from '../core/base-pipeline.js';
|
||||
import { getScriptsForURL } from './scripts.js';
|
||||
import { ASTRO_VERSION } from '../core/constants.js';
|
||||
import { getInfoOutput } from '../cli/info/index.js';
|
||||
import { PAGE_SCRIPT_ID } from '../vite-plugin-scripts/index.js';
|
||||
import { getStylesForURL } from './css.js';
|
||||
import { getComponentMetadata } from './metadata.js';
|
||||
import { createResolve } from './resolve.js';
|
||||
import { getScriptsForURL } from './scripts.js';
|
||||
|
||||
export class DevPipeline extends Pipeline {
|
||||
// renderers are loaded on every request,
|
||||
|
|
|
@ -1,22 +1,22 @@
|
|||
import { AsyncLocalStorage } from 'node:async_hooks';
|
||||
import type fs from 'node:fs';
|
||||
import { IncomingMessage } from 'node:http';
|
||||
import type * as vite from 'vite';
|
||||
import type { AstroSettings, ManifestData, SSRManifest } from '../@types/astro.js';
|
||||
import type { SSRManifestI18n } from '../core/app/types.js';
|
||||
import { getViteErrorPayload } from '../core/errors/dev/index.js';
|
||||
import { AstroError, AstroErrorData } from '../core/errors/index.js';
|
||||
import { patchOverlay } from '../core/errors/overlay.js';
|
||||
import type { Logger } from '../core/logger/core.js';
|
||||
import { createViteLoader } from '../core/module-loader/index.js';
|
||||
import { createRouteManifest } from '../core/routing/index.js';
|
||||
import { toRoutingStrategy } from '../i18n/utils.js';
|
||||
import { baseMiddleware } from './base.js';
|
||||
import { createController } from './controller.js';
|
||||
import { recordServerError } from './error.js';
|
||||
import { DevPipeline } from './pipeline.js';
|
||||
import { handleRequest } from './request.js';
|
||||
import { AstroError, AstroErrorData } from '../core/errors/index.js';
|
||||
import { getViteErrorPayload } from '../core/errors/dev/index.js';
|
||||
import { AsyncLocalStorage } from 'node:async_hooks';
|
||||
import { IncomingMessage } from 'node:http';
|
||||
import { setRouteError } from './server-state.js';
|
||||
import { recordServerError } from './error.js';
|
||||
import { toRoutingStrategy } from '../i18n/utils.js';
|
||||
|
||||
export interface AstroPluginOptions {
|
||||
settings: AstroSettings;
|
||||
|
|
|
@ -4,10 +4,10 @@ import { collapseDuplicateSlashes, removeTrailingForwardSlash } from '../core/pa
|
|||
import { isServerLikeOutput } from '../prerender/utils.js';
|
||||
import type { DevServerController } from './controller.js';
|
||||
import { runWithErrorHandling } from './controller.js';
|
||||
import { recordServerError } from './error.js';
|
||||
import type { DevPipeline } from './pipeline.js';
|
||||
import { handle500Response } from './response.js';
|
||||
import { handleRoute, matchRoute } from './route.js';
|
||||
import { recordServerError } from './error.js';
|
||||
|
||||
type HandleRequest = {
|
||||
pipeline: DevPipeline;
|
||||
|
|
|
@ -1,9 +1,11 @@
|
|||
import type http from 'node:http';
|
||||
import type { ComponentInstance, ManifestData, RouteData } from '../@types/astro.js';
|
||||
import { REROUTE_DIRECTIVE_HEADER, clientLocalsSymbol } from '../core/constants.js';
|
||||
import { AstroErrorData, isAstroError } from '../core/errors/index.js';
|
||||
import { req } from '../core/messages.js';
|
||||
import { loadMiddleware } from '../core/middleware/loadMiddleware.js';
|
||||
import { getProps, type SSROptions } from '../core/render/index.js';
|
||||
import { RenderContext } from '../core/render-context.js';
|
||||
import { type SSROptions, getProps } from '../core/render/index.js';
|
||||
import { createRequest } from '../core/request.js';
|
||||
import { matchAllRoutes } from '../core/routing/index.js';
|
||||
import { normalizeTheLocale } from '../i18n/index.js';
|
||||
|
@ -11,8 +13,6 @@ import { getSortedPreloadedMatches } from '../prerender/routing.js';
|
|||
import { isServerLikeOutput } from '../prerender/utils.js';
|
||||
import type { DevPipeline } from './pipeline.js';
|
||||
import { handle404Response, writeSSRResult, writeWebResponse } from './response.js';
|
||||
import { REROUTE_DIRECTIVE_HEADER, clientLocalsSymbol } from '../core/constants.js';
|
||||
import { RenderContext } from '../core/render-context.js';
|
||||
|
||||
type AsyncReturnType<T extends (...args: any) => Promise<any>> = T extends (
|
||||
...args: any
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { transformWithEsbuild, type ESBuildTransformResult } from 'vite';
|
||||
import { type ESBuildTransformResult, transformWithEsbuild } from 'vite';
|
||||
import type { AstroConfig } from '../@types/astro.js';
|
||||
import { compile, type CompileProps, type CompileResult } from '../core/compile/index.js';
|
||||
import { type CompileProps, type CompileResult, compile } from '../core/compile/index.js';
|
||||
import type { Logger } from '../core/logger/core.js';
|
||||
import { getFileInfo } from '../vite-plugin-utils/index.js';
|
||||
import type { CompileMetadata } from './types.js';
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import type { HmrContext } from 'vite';
|
||||
import type { Logger } from '../core/logger/core.js';
|
||||
import { frontmatterRE } from './utils.js';
|
||||
import type { CompileMetadata } from './types.js';
|
||||
import { frontmatterRE } from './utils.js';
|
||||
|
||||
export interface HandleHotUpdateOptions {
|
||||
logger: Logger;
|
||||
|
|
|
@ -2,11 +2,11 @@ import type { SourceDescription } from 'rollup';
|
|||
import type * as vite from 'vite';
|
||||
import type { AstroConfig, AstroSettings } from '../@types/astro.js';
|
||||
import type { Logger } from '../core/logger/core.js';
|
||||
import type { PluginMetadata as AstroPluginMetadata, CompileMetadata } from './types.js';
|
||||
import type { CompileMetadata, PluginMetadata as AstroPluginMetadata } from './types.js';
|
||||
|
||||
import { normalizePath } from 'vite';
|
||||
import { normalizeFilename } from '../vite-plugin-utils/index.js';
|
||||
import { compileAstro, type CompileAstroResult } from './compile.js';
|
||||
import { type CompileAstroResult, compileAstro } from './compile.js';
|
||||
import { handleHotUpdate } from './hmr.js';
|
||||
import { parseAstroRequest } from './query.js';
|
||||
import { loadId } from './utils.js';
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import path from 'node:path';
|
||||
import type { CompilerOptions } from 'typescript';
|
||||
import { normalizePath, type ResolvedConfig, type Plugin as VitePlugin } from 'vite';
|
||||
import { type Plugin as VitePlugin, type ResolvedConfig, normalizePath } from 'vite';
|
||||
import type { AstroSettings } from '../@types/astro.js';
|
||||
|
||||
type Alias = {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
import { fileURLToPath } from 'node:url';
|
||||
import type * as vite from 'vite';
|
||||
import { loadEnv } from 'vite';
|
||||
import { transform } from 'esbuild';
|
||||
import MagicString from 'magic-string';
|
||||
import type * as vite from 'vite';
|
||||
import { loadEnv } from 'vite';
|
||||
import type { AstroConfig, AstroSettings } from '../@types/astro.js';
|
||||
|
||||
interface EnvPluginOptions {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue