Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/astro/e2e/test-utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export async function scrollToElement(el) {
/**
* Create a spy logger that captures log messages into provided arrays
* @param {{info?: Array, warn?: Array, error?: Array, debug?: Array}} options - Optional arrays to push messages into
* @returns {import('../dist/core/logger/core').Logger}
* @returns {import('../dist/core/logger/core').AstroLogger}
*/
export function createLoggerSpy(options = {}) {
const infoLogs = options.info || [];
Expand All @@ -135,7 +135,7 @@ export function createLoggerSpy(options = {}) {
debugLogs.push(...messages.map((message) => ({ label, message })));
},
options: {
dest: { write: () => true },
destination: { write: () => true },
level: 'info',
},
level: () => 'info',
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/assets/build/generate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { StaticBuildOptions } from '../../core/build/types.js';
import { getTimeStat } from '../../core/build/util.js';
import { AstroError } from '../../core/errors/errors.js';
import { AstroErrorData } from '../../core/errors/index.js';
import type { Logger } from '../../core/logger/core.js';
import type { AstroLogger } from '../../core/logger/core.js';
import { isRemotePath, removeLeadingForwardSlash } from '../../core/path.js';
import type { MapValue } from '../../type-utils.js';
import type { AstroConfig } from '../../types/public/config.js';
Expand All @@ -31,7 +31,7 @@ interface GenerationDataCached {
type GenerationData = GenerationDataUncached | GenerationDataCached;

type AssetEnv = {
logger: Logger;
logger: AstroLogger;
isSSR: boolean;
count: { total: number; current: number };
useCache: boolean;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Logger } from '../../../core/logger/core.js';
import type { AstroLogger } from '../../../core/logger/core.js';
import type { FontResolver, StringMatcher } from '../definitions.js';
import type {
Collaborator,
Expand All @@ -24,7 +24,7 @@ export async function computeFontFamiliesAssets({
}: {
resolvedFamilies: Array<ResolvedFontFamily>;
fontResolver: FontResolver;
logger: Logger;
logger: AstroLogger;
bold: (input: string) => string;
defaults: Defaults;
stringMatcher: StringMatcher;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { Logger } from '../../../core/logger/core.js';
import type { AstroLogger } from '../../../core/logger/core.js';
import type { FontFamilyAssetsByUniqueKey, ResolvedFontFamily } from '../types.js';

export function getOrCreateFontFamilyAssets({
Expand All @@ -8,7 +8,7 @@ export function getOrCreateFontFamilyAssets({
family,
}: {
fontFamilyAssetsByUniqueKey: FontFamilyAssetsByUniqueKey;
logger: Logger;
logger: AstroLogger;
bold: (input: string) => string;
family: ResolvedFontFamily;
}) {
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/assets/fonts/vite-plugin-fonts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import { getAlgorithm, shouldTrackCspHashes } from '../../core/csp/common.js';
import { generateCspDigest } from '../../core/encryption.js';
import { collectErrorMetadata } from '../../core/errors/dev/utils.js';
import { AstroError, AstroErrorData, isAstroError } from '../../core/errors/index.js';
import type { Logger } from '../../core/logger/core.js';
import type { AstroLogger } from '../../core/logger/core.js';
import { formatErrorMessage } from '../../core/messages/runtime.js';
import { appendForwardSlash, joinPaths, prependForwardSlash } from '../../core/path.js';
import { getClientOutputDirectory } from '../../prerender/utils.js';
Expand Down Expand Up @@ -54,7 +54,7 @@ import type {
interface Options {
settings: AstroSettings;
sync: boolean;
logger: Logger;
logger: AstroLogger;
}

export function fontsPlugin({ settings, sync, logger }: Options): Plugin {
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/assets/vite-plugin-assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import MagicString from 'magic-string';
import picomatch from 'picomatch';
import type * as vite from 'vite';
import { AstroError, AstroErrorData } from '../core/errors/index.js';
import type { Logger } from '../core/logger/core.js';
import type { AstroLogger } from '../core/logger/core.js';
import {
appendForwardSlash,
joinPaths,
Expand Down Expand Up @@ -119,7 +119,7 @@ const addStaticImageFactory = (
interface Options {
settings: AstroSettings;
sync: boolean;
logger: Logger;
logger: AstroLogger;
fs: typeof fsMod;
}

Expand Down
18 changes: 9 additions & 9 deletions packages/astro/src/cli/add/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import {
presets,
updateTSConfigForFramework,
} from '../../core/config/tsconfig.js';
import type { Logger } from '../../core/logger/core.js';
import type { AstroLogger } from '../../core/logger/core.js';
import * as msg from '../../core/messages/runtime.js';
import { printHelp } from '../../core/messages/runtime.js';
import { appendForwardSlash } from '../../core/path.js';
Expand Down Expand Up @@ -652,7 +652,7 @@ async function updateAstroConfig({
configURL: URL;
mod: ProxifiedModule<any>;
flags: Flags;
logger: Logger;
logger: AstroLogger;
logAdapterInstructions: boolean;
}): Promise<UpdateResult> {
const input = await fs.readFile(fileURLToPath(configURL), { encoding: 'utf-8' });
Expand Down Expand Up @@ -713,7 +713,7 @@ async function updatePackageJsonOverrides({
}: {
configURL: URL;
flags: Flags;
logger: Logger;
logger: AstroLogger;
overrides: Record<string, string>;
}): Promise<UpdateResult> {
const pkgURL = new URL('./package.json', configURL);
Expand Down Expand Up @@ -774,7 +774,7 @@ async function updatePackageJsonScripts({
}: {
configURL: URL;
flags: Flags;
logger: Logger;
logger: AstroLogger;
scripts: Record<string, string>;
}): Promise<UpdateResult> {
const pkgURL = new URL('./package.json', configURL);
Expand Down Expand Up @@ -877,7 +877,7 @@ async function tryToInstallIntegrations({
integrations: IntegrationInfo[];
cwd?: string;
flags: Flags;
logger: Logger;
logger: AstroLogger;
}): Promise<UpdateResult> {
const packageManager = await detect({
cwd,
Expand Down Expand Up @@ -950,7 +950,7 @@ async function tryToInstallIntegrations({
async function validateIntegrations(
integrations: string[],
flags: yargsParser.Arguments,
logger: Logger,
logger: AstroLogger,
): Promise<IntegrationInfo[]> {
// First, validate all package names to prevent command injection
for (const integration of integrations) {
Expand Down Expand Up @@ -1069,7 +1069,7 @@ async function validateIntegrations(

async function updateTSConfig(
cwd = process.cwd(),
logger: Logger,
logger: AstroLogger,
integrationsInfo: IntegrationInfo[],
flags: Flags,
options?: { addIncludes?: string[] },
Expand Down Expand Up @@ -1193,7 +1193,7 @@ async function askToContinue({
logger,
}: {
flags: Flags;
logger: Logger;
logger: AstroLogger;
}): Promise<boolean> {
if (flags.yes || flags.y) return true;
if (!hasHintedAboutYesFlag) {
Expand Down Expand Up @@ -1237,7 +1237,7 @@ function getDiffContent(input: string, output: string): string | null {

async function setupIntegrationConfig(opts: {
root: URL;
logger: Logger;
logger: AstroLogger;
flags: Flags;
integrationName: string;
possibleConfigFiles: string[];
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/cli/create-key/core/create-key.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import type { Logger } from '../../../core/logger/core.js';
import type { AstroLogger } from '../../../core/logger/core.js';
import { defineCommand } from '../../domain/command.js';
import type { KeyGenerator } from '../definitions.js';

interface Options {
logger: Logger;
logger: AstroLogger;
keyGenerator: KeyGenerator;
}

Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/cli/docs/core/open-docs.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type { Logger } from '../../../core/logger/core.js';
import type { AstroLogger } from '../../../core/logger/core.js';
import type { CommandExecutor, OperatingSystemProvider } from '../../definitions.js';
import { defineCommand } from '../../domain/command.js';
import type { CloudIdeProvider } from '../definitions.js';

interface Options {
url: string;
operatingSystemProvider: OperatingSystemProvider;
logger: Logger;
logger: AstroLogger;
commandExecutor: CommandExecutor;
cloudIdeProvider: CloudIdeProvider;
}
Expand Down
8 changes: 4 additions & 4 deletions packages/astro/src/cli/flags.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { Arguments } from 'yargs-parser';
import type { Logger, LogOptions } from '../core/logger/core.js';
import type { AstroLogger, AstroLogOptions } from '../core/logger/core.js';
import { createNodeLogger, nodeLogDestination } from '../core/logger/node.js';
import type { AstroInlineConfig } from '../types/public/config.js';

Expand Down Expand Up @@ -40,9 +40,9 @@ export function flagsToAstroInlineConfig(flags: Flags): AstroInlineConfig {
* The `logging` is usually created from an `AstroInlineConfig`, but some flows like `add`
* doesn't read the AstroConfig directly, so we create a `logging` object from the CLI flags instead.
*/
export function createLoggerFromFlags(flags: Flags): Logger {
const logging: LogOptions = {
dest: nodeLogDestination,
export function createLoggerFromFlags(flags: Flags): AstroLogger {
const logging: AstroLogOptions = {
destination: nodeLogDestination,
level: 'info',
};

Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/cli/info/core/info.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { Logger } from '../../../core/logger/core.js';
import type { AstroLogger } from '../../../core/logger/core.js';
import { defineCommand } from '../../domain/command.js';
import type { Clipboard, DebugInfoFormatter, DebugInfoProvider } from '../definitions.js';

interface Options {
debugInfoProvider: DebugInfoProvider;
getDebugInfoFormatter: (options: { pretty: boolean }) => DebugInfoFormatter;
logger: Logger;
logger: AstroLogger;
clipboard: Clipboard;
}

Expand Down
6 changes: 3 additions & 3 deletions packages/astro/src/cli/info/infra/tinyclip-clipboard.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import type { Logger } from '../../../core/logger/core.js';
import type { AstroLogger } from '../../../core/logger/core.js';
import type { Clipboard, Prompt } from '../definitions.js';
import { writeText } from 'tinyclip';

export class TinyclipClipboard implements Clipboard {
readonly #logger: Logger;
readonly #logger: AstroLogger;
readonly #prompt: Prompt;

constructor({
logger,
prompt,
}: {
logger: Logger;
logger: AstroLogger;
prompt: Prompt;
}) {
this.#logger = logger;
Expand Down
6 changes: 3 additions & 3 deletions packages/astro/src/cli/infra/logger-help-display.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import type { Logger } from '../../core/logger/core.js';
import type { AstroLogger } from '../../core/logger/core.js';
import type { AstroVersionProvider, HelpDisplay, TextStyler } from '../definitions.js';
import type { HelpPayload } from '../domain/help-payload.js';
import type { Flags } from '../flags.js';
import { formatVersion } from '../utils/format-version.js';

export class LoggerHelpDisplay implements HelpDisplay {
readonly #logger: Logger;
readonly #logger: AstroLogger;
readonly #textStyler: TextStyler;
readonly #astroVersionProvider: AstroVersionProvider;
// TODO: find something better
Expand All @@ -17,7 +17,7 @@ export class LoggerHelpDisplay implements HelpDisplay {
astroVersionProvider,
flags,
}: {
logger: Logger;
logger: AstroLogger;
textStyler: TextStyler;
astroVersionProvider: AstroVersionProvider;
flags: Flags;
Expand Down
6 changes: 3 additions & 3 deletions packages/astro/src/cli/install-package.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as clack from '@clack/prompts';
import ci from 'ci-info';
import { detect, resolveCommand } from 'package-manager-detector';
import colors from 'piccolore';
import type { Logger } from '../core/logger/core.js';
import type { AstroLogger } from '../core/logger/core.js';
import { exec } from './exec.js';

const require = createRequire(import.meta.url);
Expand All @@ -17,7 +17,7 @@ type GetPackageOptions = {

export async function getPackage<T>(
packageName: string,
logger: Logger,
logger: AstroLogger,
options: GetPackageOptions,
otherDeps: string[] = [],
): Promise<T | undefined> {
Expand Down Expand Up @@ -57,7 +57,7 @@ export async function getPackage<T>(
async function installPackage(
packageNames: string[],
options: GetPackageOptions,
logger: Logger,
logger: AstroLogger,
): Promise<boolean> {
const cwd = options.cwd ?? process.cwd();
const packageManager = await detect({
Expand Down
6 changes: 3 additions & 3 deletions packages/astro/src/container/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { getDefaultClientDirectives } from '../core/client-directive/index.js';
import { ASTRO_CONFIG_DEFAULTS } from '../core/config/schemas/index.js';
import { validateConfig } from '../core/config/validate.js';
import { createKey } from '../core/encryption.js';
import { Logger } from '../core/logger/core.js';
import { AstroLogger } from '../core/logger/core.js';
import { nodeLogDestination } from '../core/logger/node.js';
import { NOOP_MIDDLEWARE_FN } from '../core/middleware/noop-middleware.js';
import { removeLeadingForwardSlash } from '../core/path.js';
Expand Down Expand Up @@ -301,9 +301,9 @@ export class experimental_AstroContainer {
astroConfig,
}: AstroContainerConstructor) {
this.#pipeline = ContainerPipeline.create({
logger: new Logger({
logger: new AstroLogger({
level: 'info',
dest: nodeLogDestination,
destination: nodeLogDestination,
}),
manifest: createManifest(manifest, renderers),
streaming,
Expand Down
6 changes: 3 additions & 3 deletions packages/astro/src/content/content-layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import type { FSWatcher } from 'vite';
import xxhash from 'xxhash-wasm';
import type * as z from 'zod/v4';
import { AstroError, AstroErrorData } from '../core/errors/index.js';
import type { Logger } from '../core/logger/core.js';
import type { AstroLogger } from '../core/logger/core.js';
import type { AstroSettings } from '../types/astro.js';
import type { ContentEntryType, RefreshContentOptions } from '../types/public/content.js';
import {
Expand All @@ -35,7 +35,7 @@ import { createWatcherWrapper, type WrappedWatcher } from './watcher.js';
export interface ContentLayerOptions {
store: MutableDataStore;
settings: AstroSettings;
logger: Logger;
logger: AstroLogger;
watcher?: FSWatcher;
contentConfigObserver?: ContentObservable;
}
Expand All @@ -47,7 +47,7 @@ type CollectionLoader<TData> = () =>
| Promise<Record<string, Record<string, unknown>>>;

export class ContentLayer {
#logger: Logger;
#logger: AstroLogger;
#store: MutableDataStore;
#settings: AstroSettings;
#watcher?: WrappedWatcher;
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/content/instance.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type { FSWatcher } from 'vite';
import { ContentLayer } from './content-layer.js';
import type { Logger } from '../core/logger/core.js';
import type { AstroLogger } from '../core/logger/core.js';
import type { AstroSettings } from '../types/astro.js';
import type { MutableDataStore } from './mutable-data-store.js';

interface ContentLayerOptions {
store: MutableDataStore;
settings: AstroSettings;
logger: Logger;
logger: AstroLogger;
watcher?: FSWatcher;
}

Expand Down
4 changes: 2 additions & 2 deletions packages/astro/src/content/server-listeners.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import type fsMod from 'node:fs';
import type { ViteDevServer } from 'vite';
import type { Logger } from '../core/logger/core.js';
import type { AstroLogger } from '../core/logger/core.js';
import type { AstroSettings } from '../types/astro.js';
import { createContentTypesGenerator } from './types-generator.js';
import { globalContentConfigObserver } from './utils.js';

interface ContentServerListenerParams {
fs: typeof fsMod;
logger: Logger;
logger: AstroLogger;
settings: AstroSettings;
viteServer: ViteDevServer;
}
Expand Down
Loading
Loading