diff --git a/packages/astro-rss/src/util.ts b/packages/astro-rss/src/util.ts index a87828bfc7..63a8c5568a 100644 --- a/packages/astro-rss/src/util.ts +++ b/packages/astro-rss/src/util.ts @@ -1,5 +1,5 @@ -import { z } from 'astro/zod'; -import { RSSOptions } from './index'; +import type { z } from 'astro/zod'; +import type { RSSOptions } from './index'; /** Normalize URL to its canonical form */ export function createCanonicalURL( diff --git a/packages/astro/src/@types/astro.ts b/packages/astro/src/@types/astro.ts index 1100cd5f80..3ce8be97fc 100644 --- a/packages/astro/src/@types/astro.ts +++ b/packages/astro/src/@types/astro.ts @@ -20,7 +20,7 @@ import type { AstroTimer } from '../core/config/timer'; import type { AstroCookies } from '../core/cookies'; import type { LogOptions } from '../core/logger/core'; import type { AstroComponentFactory, AstroComponentInstance } from '../runtime/server'; -import { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from './../core/constants.js'; +import type { SUPPORTED_MARKDOWN_FILE_EXTENSIONS } from './../core/constants.js'; export type { MarkdownHeading, MarkdownMetadata, diff --git a/packages/astro/src/assets/internal.ts b/packages/astro/src/assets/internal.ts index 0202e2359d..3bad39ae40 100644 --- a/packages/astro/src/assets/internal.ts +++ b/packages/astro/src/assets/internal.ts @@ -1,8 +1,8 @@ import fs from 'node:fs'; import path from 'node:path'; import { pathToFileURL } from 'node:url'; -import { AstroSettings } from '../@types/astro.js'; -import { StaticBuildOptions } from '../core/build/types.js'; +import type { AstroSettings } from '../@types/astro.js'; +import type { StaticBuildOptions } from '../core/build/types.js'; import { AstroError, AstroErrorData } from '../core/errors/index.js'; import { rootRelativePath } from '../core/util.js'; import { ImageService, isLocalService, LocalImageService } from './services/service.js'; diff --git a/packages/astro/src/assets/services/service.ts b/packages/astro/src/assets/services/service.ts index 9295db3a94..0e2c483f8e 100644 --- a/packages/astro/src/assets/services/service.ts +++ b/packages/astro/src/assets/services/service.ts @@ -2,7 +2,7 @@ import { AstroError, AstroErrorData } from '../../core/errors/index.js'; import { isRemotePath } from '../../core/path.js'; import { VALID_INPUT_FORMATS } from '../consts.js'; import { isESMImportedImage } from '../internal.js'; -import { ImageTransform, OutputFormat } from '../types.js'; +import type { ImageTransform, OutputFormat } from '../types.js'; export type ImageService = LocalImageService | ExternalImageService; diff --git a/packages/astro/src/assets/types.ts b/packages/astro/src/assets/types.ts index f3f54b2dd0..4a97354bf4 100644 --- a/packages/astro/src/assets/types.ts +++ b/packages/astro/src/assets/types.ts @@ -1,6 +1,6 @@ /* eslint-disable @typescript-eslint/ban-types */ -import { VALID_INPUT_FORMATS, VALID_OUTPUT_FORMATS } from './consts.js'; -import { ImageService } from './services/service.js'; +import type { VALID_INPUT_FORMATS, VALID_OUTPUT_FORMATS } from './consts.js'; +import type { ImageService } from './services/service.js'; export type ImageQualityPreset = 'low' | 'mid' | 'high' | 'max' | (string & {}); export type ImageQuality = ImageQualityPreset | number; diff --git a/packages/astro/src/assets/utils/metadata.ts b/packages/astro/src/assets/utils/metadata.ts index fa6bb9e10f..e276b08999 100644 --- a/packages/astro/src/assets/utils/metadata.ts +++ b/packages/astro/src/assets/utils/metadata.ts @@ -1,6 +1,6 @@ import fs from 'node:fs/promises'; import { fileURLToPath } from 'node:url'; -import { ImageMetadata, InputFormat } from '../types.js'; +import type { ImageMetadata, InputFormat } from '../types.js'; export interface Metadata extends ImageMetadata { orientation?: number; diff --git a/packages/astro/src/assets/utils/queryParams.ts b/packages/astro/src/assets/utils/queryParams.ts index e2753201ea..980c3dcd96 100644 --- a/packages/astro/src/assets/utils/queryParams.ts +++ b/packages/astro/src/assets/utils/queryParams.ts @@ -1,4 +1,4 @@ -import { ImageMetadata, InputFormat } from '../types.js'; +import type { ImageMetadata, InputFormat } from '../types.js'; export function getOrigQueryParams( params: URLSearchParams diff --git a/packages/astro/src/assets/utils/transformToPath.ts b/packages/astro/src/assets/utils/transformToPath.ts index 925407eb10..5a73fca3c6 100644 --- a/packages/astro/src/assets/utils/transformToPath.ts +++ b/packages/astro/src/assets/utils/transformToPath.ts @@ -2,7 +2,7 @@ import { basename, extname } from 'path'; import { removeQueryString } from '../../core/path.js'; import { shorthash } from '../../runtime/server/shorthash.js'; import { isESMImportedImage } from '../internal.js'; -import { ImageTransform } from '../types.js'; +import type { ImageTransform } from '../types.js'; export function propsToFilename(transform: ImageTransform) { if (!isESMImportedImage(transform.src)) { diff --git a/packages/astro/src/assets/vite-plugin-assets.ts b/packages/astro/src/assets/vite-plugin-assets.ts index 9af9c6073b..f3c022e616 100644 --- a/packages/astro/src/assets/vite-plugin-assets.ts +++ b/packages/astro/src/assets/vite-plugin-assets.ts @@ -5,7 +5,7 @@ import { Readable } from 'node:stream'; import { fileURLToPath } from 'node:url'; import type * as vite from 'vite'; import { normalizePath } from 'vite'; -import { AstroPluginOptions, ImageTransform } from '../@types/astro'; +import type { AstroPluginOptions, ImageTransform } from '../@types/astro'; import { error } from '../core/logger/core.js'; import { joinPaths, prependForwardSlash } from '../core/path.js'; import { VIRTUAL_MODULE_ID, VIRTUAL_SERVICE_ID } from './consts.js'; diff --git a/packages/astro/src/content/utils.ts b/packages/astro/src/content/utils.ts index 22b71e0afe..1fd6007481 100644 --- a/packages/astro/src/content/utils.ts +++ b/packages/astro/src/content/utils.ts @@ -6,7 +6,7 @@ import { fileURLToPath, pathToFileURL } from 'node:url'; import type { EmitFile } from 'rollup'; import { ErrorPayload as ViteErrorPayload, normalizePath, ViteDevServer } from 'vite'; import { z } from 'zod'; -import { AstroConfig, AstroSettings } from '../@types/astro.js'; +import type { AstroConfig, AstroSettings } from '../@types/astro.js'; import { emitESMImage } from '../assets/internal.js'; import { AstroError, AstroErrorData } from '../core/errors/index.js'; import { CONTENT_TYPES_FILE } from './consts.js'; diff --git a/packages/astro/src/content/vite-plugin-content-assets.ts b/packages/astro/src/content/vite-plugin-content-assets.ts index cda8aff64c..3bfbc697fa 100644 --- a/packages/astro/src/content/vite-plugin-content-assets.ts +++ b/packages/astro/src/content/vite-plugin-content-assets.ts @@ -1,10 +1,10 @@ import npath from 'node:path'; import { pathToFileURL } from 'url'; import type { Plugin } from 'vite'; -import { AstroSettings } from '../@types/astro.js'; +import type { AstroSettings } from '../@types/astro.js'; import { moduleIsTopLevelPage, walkParentInfos } from '../core/build/graph.js'; import { BuildInternals, getPageDataByViteID } from '../core/build/internal.js'; -import { AstroBuildPlugin } from '../core/build/plugin.js'; +import type { AstroBuildPlugin } from '../core/build/plugin.js'; import type { StaticBuildOptions } from '../core/build/types'; import type { ModuleLoader } from '../core/module-loader/loader.js'; import { createViteLoader } from '../core/module-loader/vite.js'; diff --git a/packages/astro/src/content/vite-plugin-content-imports.ts b/packages/astro/src/content/vite-plugin-content-imports.ts index a81d1febaa..c5b8e732b5 100644 --- a/packages/astro/src/content/vite-plugin-content-imports.ts +++ b/packages/astro/src/content/vite-plugin-content-imports.ts @@ -3,7 +3,7 @@ import type fsMod from 'node:fs'; import { extname } from 'node:path'; import { pathToFileURL } from 'url'; import type { Plugin } from 'vite'; -import { AstroSettings, ContentEntryType } from '../@types/astro.js'; +import type { AstroSettings, ContentEntryType } from '../@types/astro.js'; import { AstroErrorData } from '../core/errors/errors-data.js'; import { AstroError } from '../core/errors/errors.js'; import { escapeViteEnvReferences, getFileInfo } from '../vite-plugin-utils/index.js'; diff --git a/packages/astro/src/core/app/node.ts b/packages/astro/src/core/app/node.ts index 2ab662d669..637417bd4c 100644 --- a/packages/astro/src/core/app/node.ts +++ b/packages/astro/src/core/app/node.ts @@ -2,7 +2,7 @@ import type { RouteData } from '../../@types/astro'; import type { SerializedSSRManifest, SSRManifest } from './types'; import * as fs from 'fs'; -import { IncomingMessage } from 'http'; +import type { IncomingMessage } from 'http'; import { TLSSocket } from 'tls'; import { deserializeManifest } from './common.js'; import { App, MatchOptions } from './index.js'; diff --git a/packages/astro/src/core/build/add-rollup-input.ts b/packages/astro/src/core/build/add-rollup-input.ts index 79feb3a7d6..4043d3ecd3 100644 --- a/packages/astro/src/core/build/add-rollup-input.ts +++ b/packages/astro/src/core/build/add-rollup-input.ts @@ -1,4 +1,4 @@ -import { InputOptions } from 'rollup'; +import type { InputOptions } from 'rollup'; function fromEntries(entries: [string, V][]) { const obj: Record = {}; diff --git a/packages/astro/src/core/build/css-asset-name.ts b/packages/astro/src/core/build/css-asset-name.ts index d9112a1729..132df6017e 100644 --- a/packages/astro/src/core/build/css-asset-name.ts +++ b/packages/astro/src/core/build/css-asset-name.ts @@ -2,7 +2,7 @@ import type { GetModuleInfo } from 'rollup'; import crypto from 'crypto'; import npath from 'path'; -import { AstroSettings } from '../../@types/astro'; +import type { AstroSettings } from '../../@types/astro'; import { viteID } from '../util.js'; import { getTopLevelPages } from './graph.js'; diff --git a/packages/astro/src/core/build/index.ts b/packages/astro/src/core/build/index.ts index 29dc835ff2..4123b71d9b 100644 --- a/packages/astro/src/core/build/index.ts +++ b/packages/astro/src/core/build/index.ts @@ -5,8 +5,8 @@ import type { LogOptions } from '../logger/core'; import fs from 'fs'; import * as colors from 'kleur/colors'; import { performance } from 'perf_hooks'; -import * as vite from 'vite'; -import yargs from 'yargs-parser'; +import type * as vite from 'vite'; +import type yargs from 'yargs-parser'; import { runHookBuildDone, runHookBuildStart, @@ -21,7 +21,7 @@ import { RouteCache } from '../render/route-cache.js'; import { createRouteManifest } from '../routing/index.js'; import { collectPagesData } from './page-data.js'; import { staticBuild, viteBuild } from './static-build.js'; -import { StaticBuildOptions } from './types.js'; +import type { StaticBuildOptions } from './types.js'; import { getTimeStat } from './util.js'; export interface BuildOptions { diff --git a/packages/astro/src/core/build/internal.ts b/packages/astro/src/core/build/internal.ts index 7ae350e6fd..5b7d1d2a51 100644 --- a/packages/astro/src/core/build/internal.ts +++ b/packages/astro/src/core/build/internal.ts @@ -1,8 +1,8 @@ import type { OutputChunk, RenderedChunk } from 'rollup'; import type { PageBuildData, ViteID } from './types'; -import { SSRResult } from '../../@types/astro'; -import { PageOptions } from '../../vite-plugin-astro/types'; +import type { SSRResult } from '../../@types/astro'; +import type { PageOptions } from '../../vite-plugin-astro/types'; import { prependForwardSlash, removeFileExtension } from '../path.js'; import { viteID } from '../util.js'; diff --git a/packages/astro/src/core/build/plugins/plugin-alias-resolve.ts b/packages/astro/src/core/build/plugins/plugin-alias-resolve.ts index 7b0aba7e86..052ea45b76 100644 --- a/packages/astro/src/core/build/plugins/plugin-alias-resolve.ts +++ b/packages/astro/src/core/build/plugins/plugin-alias-resolve.ts @@ -1,6 +1,6 @@ import type { Alias, Plugin as VitePlugin } from 'vite'; import type { BuildInternals } from '../internal.js'; -import { AstroBuildPlugin } from '../plugin.js'; +import type { AstroBuildPlugin } from '../plugin.js'; /** * `@rollup/plugin-alias` doesn't resolve aliases in Rollup input by default. This plugin fixes it diff --git a/packages/astro/src/core/build/plugins/plugin-hoisted-scripts.ts b/packages/astro/src/core/build/plugins/plugin-hoisted-scripts.ts index da40ede65c..38d8323848 100644 --- a/packages/astro/src/core/build/plugins/plugin-hoisted-scripts.ts +++ b/packages/astro/src/core/build/plugins/plugin-hoisted-scripts.ts @@ -3,8 +3,8 @@ import type { AstroSettings } from '../../../@types/astro'; import { viteID } from '../../util.js'; import type { BuildInternals } from '../internal.js'; import { getPageDataByViteID } from '../internal.js'; -import { AstroBuildPlugin } from '../plugin'; -import { StaticBuildOptions } from '../types'; +import type { AstroBuildPlugin } from '../plugin'; +import type { StaticBuildOptions } from '../types'; function virtualHoistedEntry(id: string) { return id.startsWith('/astro/hoisted.js?q='); diff --git a/packages/astro/src/core/build/plugins/plugin-ssr.ts b/packages/astro/src/core/build/plugins/plugin-ssr.ts index 9bf7a059f9..c8883a438c 100644 --- a/packages/astro/src/core/build/plugins/plugin-ssr.ts +++ b/packages/astro/src/core/build/plugins/plugin-ssr.ts @@ -14,7 +14,7 @@ import { serializeRouteData } from '../../routing/index.js'; import { addRollupInput } from '../add-rollup-input.js'; import { getOutFile, getOutFolder } from '../common.js'; import { eachPrerenderedPageData, eachServerPageData, sortedCSS } from '../internal.js'; -import { AstroBuildPlugin } from '../plugin'; +import type { AstroBuildPlugin } from '../plugin'; export const virtualModuleId = '@astrojs-ssr-virtual-entry'; const resolvedVirtualModuleId = '\0' + virtualModuleId; diff --git a/packages/astro/src/core/config/config.ts b/packages/astro/src/core/config/config.ts index 19583bddea..9c45c9c5f7 100644 --- a/packages/astro/src/core/config/config.ts +++ b/packages/astro/src/core/config/config.ts @@ -7,7 +7,7 @@ import path from 'path'; import { fileURLToPath, pathToFileURL } from 'url'; import { mergeConfig as mergeViteConfig } from 'vite'; import { AstroError, AstroErrorData } from '../errors/index.js'; -import { LogOptions } from '../logger/core.js'; +import type { LogOptions } from '../logger/core.js'; import { arraify, isObject, isURL } from '../util.js'; import { createRelativeSchema } from './schema.js'; import { loadConfigWithVite } from './vite-load.js'; diff --git a/packages/astro/src/core/config/schema.ts b/packages/astro/src/core/config/schema.ts index 89bdd2ccaf..5848222dec 100644 --- a/packages/astro/src/core/config/schema.ts +++ b/packages/astro/src/core/config/schema.ts @@ -3,7 +3,7 @@ import { markdownConfigDefaults } from '@astrojs/markdown-remark'; import type { ILanguageRegistration, IThemeRegistration, Theme } from 'shiki'; import type { AstroUserConfig, ViteUserConfig } from '../../@types/astro'; -import { OutgoingHttpHeaders } from 'http'; +import type { OutgoingHttpHeaders } from 'http'; import { BUNDLED_THEMES } from 'shiki'; import { z } from 'zod'; import { appendForwardSlash, prependForwardSlash, trimSlashes } from '../path.js'; diff --git a/packages/astro/src/core/dev/container.ts b/packages/astro/src/core/dev/container.ts index 22c489b2e5..1b1ccca678 100644 --- a/packages/astro/src/core/dev/container.ts +++ b/packages/astro/src/core/dev/container.ts @@ -1,4 +1,4 @@ -import * as http from 'http'; +import type * as http from 'http'; import type { AddressInfo } from 'net'; import type { AstroSettings, AstroUserConfig } from '../../@types/astro'; @@ -13,7 +13,7 @@ import { } from '../../integrations/index.js'; import { createDefaultDevSettings, resolveRoot } from '../config/index.js'; import { createVite } from '../create-vite.js'; -import { LogOptions } from '../logger/core.js'; +import type { LogOptions } from '../logger/core.js'; import { nodeLogDestination } from '../logger/node.js'; import { appendForwardSlash } from '../path.js'; import { apply as applyPolyfill } from '../polyfill.js'; diff --git a/packages/astro/src/core/dev/dev.ts b/packages/astro/src/core/dev/dev.ts index b6f051e08e..800107bcd0 100644 --- a/packages/astro/src/core/dev/dev.ts +++ b/packages/astro/src/core/dev/dev.ts @@ -3,8 +3,8 @@ import type http from 'http'; import { cyan } from 'kleur/colors'; import type { AddressInfo } from 'net'; import { performance } from 'perf_hooks'; -import * as vite from 'vite'; -import yargs from 'yargs-parser'; +import type * as vite from 'vite'; +import type yargs from 'yargs-parser'; import type { AstroSettings } from '../../@types/astro'; import { attachContentServerListeners } from '../../content/index.js'; import { info, LogOptions, warn } from '../logger/core.js'; diff --git a/packages/astro/src/core/errors/errors.ts b/packages/astro/src/core/errors/errors.ts index 7125283292..8ff43c60ee 100644 --- a/packages/astro/src/core/errors/errors.ts +++ b/packages/astro/src/core/errors/errors.ts @@ -1,5 +1,5 @@ import type { DiagnosticCode } from '@astrojs/compiler/shared/diagnostics.js'; -import { AstroErrorCodes } from './errors-data.js'; +import type { AstroErrorCodes } from './errors-data.js'; import { codeFrame } from './printer.js'; import { getErrorDataByCode } from './utils.js'; diff --git a/packages/astro/src/core/errors/utils.ts b/packages/astro/src/core/errors/utils.ts index b4d37354f9..52a7f9d8c4 100644 --- a/packages/astro/src/core/errors/utils.ts +++ b/packages/astro/src/core/errors/utils.ts @@ -1,4 +1,4 @@ -import { DiagnosticCode } from '@astrojs/compiler/shared/diagnostics.js'; +import type { DiagnosticCode } from '@astrojs/compiler/shared/diagnostics.js'; import type { SSRError } from '../../@types/astro.js'; import { AstroErrorCodes, AstroErrorData, ErrorData } from './errors-data.js'; diff --git a/packages/astro/src/core/messages.ts b/packages/astro/src/core/messages.ts index 817958876d..6d41f2796c 100644 --- a/packages/astro/src/core/messages.ts +++ b/packages/astro/src/core/messages.ts @@ -14,8 +14,8 @@ import { underline, yellow, } from 'kleur/colors'; -import { ResolvedServerUrls } from 'vite'; -import { ZodError } from 'zod'; +import type { ResolvedServerUrls } from 'vite'; +import type { ZodError } from 'zod'; import { renderErrorMarkdown } from './errors/dev/utils.js'; import { AstroError, CompilerError, ErrorWithMetadata } from './errors/index.js'; import { emoji, padMultilineString } from './util.js'; diff --git a/packages/astro/src/core/preview/static-preview-server.ts b/packages/astro/src/core/preview/static-preview-server.ts index 0103ea74e2..52cd7da73e 100644 --- a/packages/astro/src/core/preview/static-preview-server.ts +++ b/packages/astro/src/core/preview/static-preview-server.ts @@ -1,4 +1,4 @@ -import http from 'http'; +import type http from 'http'; import { performance } from 'perf_hooks'; import enableDestroy from 'server-destroy'; import { fileURLToPath } from 'url'; diff --git a/packages/astro/src/core/preview/vite-plugin-astro-preview.ts b/packages/astro/src/core/preview/vite-plugin-astro-preview.ts index 95ff4d2259..1d2453b462 100644 --- a/packages/astro/src/core/preview/vite-plugin-astro-preview.ts +++ b/packages/astro/src/core/preview/vite-plugin-astro-preview.ts @@ -1,7 +1,7 @@ import fs from 'fs'; import { fileURLToPath } from 'url'; -import { Plugin } from 'vite'; -import { AstroSettings } from '../../@types/astro.js'; +import type { Plugin } from 'vite'; +import type { AstroSettings } from '../../@types/astro.js'; import { notFoundTemplate, subpathNotUsedTemplate } from '../../template/4xx.js'; import { stripBase } from './util.js'; diff --git a/packages/astro/src/core/render/dev/css.ts b/packages/astro/src/core/render/dev/css.ts index db33935d5e..1d80a85268 100644 --- a/packages/astro/src/core/render/dev/css.ts +++ b/packages/astro/src/core/render/dev/css.ts @@ -1,6 +1,6 @@ import type { ModuleLoader } from '../../module-loader/index'; -import { RuntimeMode } from '../../../@types/astro.js'; +import type { RuntimeMode } from '../../../@types/astro.js'; import { viteID } from '../../util.js'; import { isBuildableCSSRequest } from './util.js'; import { crawlGraph } from './vite.js'; diff --git a/packages/astro/src/core/render/paginate.ts b/packages/astro/src/core/render/paginate.ts index 799637e0ff..7c9d06e0de 100644 --- a/packages/astro/src/core/render/paginate.ts +++ b/packages/astro/src/core/render/paginate.ts @@ -1,4 +1,4 @@ -import { +import type { GetStaticPathsResult, Page, PaginateFunction, diff --git a/packages/astro/src/events/error.ts b/packages/astro/src/events/error.ts index f8342fbf4c..180c3df1d2 100644 --- a/packages/astro/src/events/error.ts +++ b/packages/astro/src/events/error.ts @@ -1,4 +1,4 @@ -import { ZodError } from 'zod'; +import type { ZodError } from 'zod'; import { AstroError, AstroErrorData, ErrorWithMetadata } from '../core/errors/index.js'; import { getErrorDataByCode } from '../core/errors/utils.js'; diff --git a/packages/astro/src/integrations/index.ts b/packages/astro/src/integrations/index.ts index f4fac4fd19..3249345757 100644 --- a/packages/astro/src/integrations/index.ts +++ b/packages/astro/src/integrations/index.ts @@ -3,7 +3,7 @@ import type { AddressInfo } from 'net'; import fs from 'node:fs'; import { fileURLToPath } from 'node:url'; import type { InlineConfig, ViteDevServer } from 'vite'; -import { +import type { AstroConfig, AstroRenderer, AstroSettings, diff --git a/packages/astro/src/runtime/server/jsx.ts b/packages/astro/src/runtime/server/jsx.ts index e139a74e7e..3e8e521c79 100644 --- a/packages/astro/src/runtime/server/jsx.ts +++ b/packages/astro/src/runtime/server/jsx.ts @@ -1,5 +1,5 @@ /* eslint-disable no-console */ -import { SSRResult } from '../../@types/astro.js'; +import type { SSRResult } from '../../@types/astro.js'; import { AstroJSX, AstroVNode, isVNode } from '../../jsx-runtime/index.js'; import { escapeHTML, diff --git a/packages/astro/src/runtime/server/render/tags.ts b/packages/astro/src/runtime/server/render/tags.ts index 57935237bb..fe9829d0cd 100644 --- a/packages/astro/src/runtime/server/render/tags.ts +++ b/packages/astro/src/runtime/server/render/tags.ts @@ -1,4 +1,4 @@ -import { SSRElement, SSRResult } from '../../../@types/astro'; +import type { SSRElement, SSRResult } from '../../../@types/astro'; import { renderElement } from './util.js'; const stylesheetRel = 'stylesheet'; diff --git a/packages/astro/src/vite-plugin-astro-server/plugin.ts b/packages/astro/src/vite-plugin-astro-server/plugin.ts index b15f98fa8b..29f83c85cd 100644 --- a/packages/astro/src/vite-plugin-astro-server/plugin.ts +++ b/packages/astro/src/vite-plugin-astro-server/plugin.ts @@ -3,7 +3,7 @@ import type { AstroSettings, ManifestData } from '../@types/astro'; import type fs from 'fs'; import { patchOverlay } from '../core/errors/overlay.js'; -import { LogOptions } from '../core/logger/core.js'; +import type { LogOptions } from '../core/logger/core.js'; import { createViteLoader } from '../core/module-loader/index.js'; import { createDevelopmentEnvironment } from '../core/render/dev/index.js'; import { createRouteManifest } from '../core/routing/index.js'; diff --git a/packages/astro/src/vite-plugin-astro-server/route.ts b/packages/astro/src/vite-plugin-astro-server/route.ts index d26fc62d70..de58daa713 100644 --- a/packages/astro/src/vite-plugin-astro-server/route.ts +++ b/packages/astro/src/vite-plugin-astro-server/route.ts @@ -1,7 +1,11 @@ import type http from 'http'; import mime from 'mime'; import type { AstroSettings, ComponentInstance, ManifestData, RouteData } from '../@types/astro'; -import { ComponentPreload, DevelopmentEnvironment, SSROptions } from '../core/render/dev/index'; +import type { + ComponentPreload, + DevelopmentEnvironment, + SSROptions, +} from '../core/render/dev/index'; import { attachToResponse } from '../core/cookies/index.js'; import { call as callEndpoint } from '../core/endpoint/dev/index.js'; diff --git a/packages/astro/src/vite-plugin-astro/compile.ts b/packages/astro/src/vite-plugin-astro/compile.ts index 34fe645e55..5b4c3f6ce8 100644 --- a/packages/astro/src/vite-plugin-astro/compile.ts +++ b/packages/astro/src/vite-plugin-astro/compile.ts @@ -1,7 +1,7 @@ import { ESBuildTransformResult, transformWithEsbuild } from 'vite'; -import { AstroConfig } from '../@types/astro'; +import type { AstroConfig } from '../@types/astro'; import { cachedCompilation, CompileProps, CompileResult } from '../core/compile/index.js'; -import { LogOptions } from '../core/logger/core.js'; +import type { LogOptions } from '../core/logger/core.js'; import { getFileInfo } from '../vite-plugin-utils/index.js'; interface CachedFullCompilation { diff --git a/packages/astro/src/vite-plugin-head-propagation/index.ts b/packages/astro/src/vite-plugin-head-propagation/index.ts index b17d5f382e..6dbd761690 100644 --- a/packages/astro/src/vite-plugin-head-propagation/index.ts +++ b/packages/astro/src/vite-plugin-head-propagation/index.ts @@ -4,7 +4,7 @@ import type { BuildInternals } from '../core/build/internal.js'; import type { AstroBuildPlugin } from '../core/build/plugin.js'; import type { StaticBuildOptions } from '../core/build/types'; -import * as vite from 'vite'; +import type * as vite from 'vite'; import { walkParentInfos } from '../core/build/graph.js'; import { getAstroMetadata } from '../vite-plugin-astro/index.js'; diff --git a/packages/astro/src/vite-plugin-html/transform/slots.ts b/packages/astro/src/vite-plugin-html/transform/slots.ts index 5f0f432cbd..e89cad42cf 100644 --- a/packages/astro/src/vite-plugin-html/transform/slots.ts +++ b/packages/astro/src/vite-plugin-html/transform/slots.ts @@ -1,7 +1,7 @@ import type { Root, RootContent } from 'hast'; import type { Plugin } from 'unified'; -import MagicString from 'magic-string'; +import type MagicString from 'magic-string'; import { visit } from 'unist-util-visit'; import { escape } from './utils.js'; diff --git a/packages/astro/src/vite-plugin-html/transform/utils.ts b/packages/astro/src/vite-plugin-html/transform/utils.ts index 8a277ce728..6d61e7532d 100644 --- a/packages/astro/src/vite-plugin-html/transform/utils.ts +++ b/packages/astro/src/vite-plugin-html/transform/utils.ts @@ -1,5 +1,5 @@ import type { Element } from 'hast'; -import MagicString from 'magic-string'; +import type MagicString from 'magic-string'; const splitAttrsTokenizer = /([\$\{\}\@a-z0-9_\:\-]*)\s*?=\s*?(['"]?)(.*?)\2\s+/gim; diff --git a/packages/astro/src/vite-plugin-integrations-container/index.ts b/packages/astro/src/vite-plugin-integrations-container/index.ts index a7967092e0..0169a6f715 100644 --- a/packages/astro/src/vite-plugin-integrations-container/index.ts +++ b/packages/astro/src/vite-plugin-integrations-container/index.ts @@ -1,6 +1,6 @@ -import { Plugin as VitePlugin } from 'vite'; -import { AstroSettings } from '../@types/astro.js'; -import { LogOptions } from '../core/logger/core.js'; +import type { Plugin as VitePlugin } from 'vite'; +import type { AstroSettings } from '../@types/astro.js'; +import type { LogOptions } from '../core/logger/core.js'; import { runHookServerSetup } from '../integrations/index.js'; /** Connect Astro integrations into Vite, as needed. */ diff --git a/packages/astro/src/vite-plugin-jsx/import-source.ts b/packages/astro/src/vite-plugin-jsx/import-source.ts index f21d2ba02e..35efcaedac 100644 --- a/packages/astro/src/vite-plugin-jsx/import-source.ts +++ b/packages/astro/src/vite-plugin-jsx/import-source.ts @@ -1,5 +1,5 @@ -import { TsConfigJson } from 'tsconfig-resolver'; -import { AstroRenderer } from '../@types/astro'; +import type { TsConfigJson } from 'tsconfig-resolver'; +import type { AstroRenderer } from '../@types/astro'; import { parseNpmName } from '../core/util.js'; export async function detectImportSource( diff --git a/packages/astro/src/vite-plugin-markdown/content-entry-type.ts b/packages/astro/src/vite-plugin-markdown/content-entry-type.ts index e94d18ad44..cbf5cc957e 100644 --- a/packages/astro/src/vite-plugin-markdown/content-entry-type.ts +++ b/packages/astro/src/vite-plugin-markdown/content-entry-type.ts @@ -1,5 +1,5 @@ import { fileURLToPath } from 'node:url'; -import { ContentEntryType } from '../@types/astro.js'; +import type { ContentEntryType } from '../@types/astro.js'; import { parseFrontmatter } from '../content/utils.js'; export const markdownContentEntryType: ContentEntryType = { diff --git a/packages/astro/src/vite-plugin-scanner/index.ts b/packages/astro/src/vite-plugin-scanner/index.ts index 92d6a16eb6..330b9390c5 100644 --- a/packages/astro/src/vite-plugin-scanner/index.ts +++ b/packages/astro/src/vite-plugin-scanner/index.ts @@ -1,5 +1,5 @@ import { normalizePath, Plugin as VitePlugin } from 'vite'; -import { AstroSettings } from '../@types/astro.js'; +import type { AstroSettings } from '../@types/astro.js'; import { isEndpoint, isPage } from '../core/util.js'; import { scan } from './scan.js'; diff --git a/packages/astro/src/vite-plugin-scanner/scan.ts b/packages/astro/src/vite-plugin-scanner/scan.ts index 28e453f433..bb6efe9f5a 100644 --- a/packages/astro/src/vite-plugin-scanner/scan.ts +++ b/packages/astro/src/vite-plugin-scanner/scan.ts @@ -1,6 +1,6 @@ import * as eslexer from 'es-module-lexer'; import { AstroError, AstroErrorData } from '../core/errors/index.js'; -import { PageOptions } from '../vite-plugin-astro/types.js'; +import type { PageOptions } from '../vite-plugin-astro/types.js'; const BOOLEAN_EXPORTS = new Set(['prerender']); diff --git a/packages/astro/src/vite-plugin-scripts/index.ts b/packages/astro/src/vite-plugin-scripts/index.ts index 00cbe690f6..18f90b0579 100644 --- a/packages/astro/src/vite-plugin-scripts/index.ts +++ b/packages/astro/src/vite-plugin-scripts/index.ts @@ -1,5 +1,5 @@ -import { ConfigEnv, Plugin as VitePlugin } from 'vite'; -import { AstroSettings, InjectedScriptStage } from '../@types/astro.js'; +import type { ConfigEnv, Plugin as VitePlugin } from 'vite'; +import type { AstroSettings, InjectedScriptStage } from '../@types/astro.js'; // NOTE: We can't use the virtual "\0" ID convention because we need to // inject these as ESM imports into actual code, where they would not diff --git a/packages/astro/src/vite-plugin-scripts/page-ssr.ts b/packages/astro/src/vite-plugin-scripts/page-ssr.ts index 98d12d73d0..c004a6634f 100644 --- a/packages/astro/src/vite-plugin-scripts/page-ssr.ts +++ b/packages/astro/src/vite-plugin-scripts/page-ssr.ts @@ -1,6 +1,6 @@ import MagicString from 'magic-string'; import { normalizePath, Plugin as VitePlugin } from 'vite'; -import { AstroSettings } from '../@types/astro.js'; +import type { AstroSettings } from '../@types/astro.js'; import { isPage } from '../core/util.js'; import { PAGE_SSR_SCRIPT_ID } from './index.js'; diff --git a/packages/create-astro/src/actions/intro.ts b/packages/create-astro/src/actions/intro.ts index ec0c2248b0..e4370d706e 100644 --- a/packages/create-astro/src/actions/intro.ts +++ b/packages/create-astro/src/actions/intro.ts @@ -1,4 +1,4 @@ -import { type Context } from './context'; +import type { Context } from './context'; import { color, label } from '@astrojs/cli-kit'; import { random } from '@astrojs/cli-kit/utils'; diff --git a/packages/create-astro/src/actions/next-steps.ts b/packages/create-astro/src/actions/next-steps.ts index db7387ad12..1b3a0db286 100644 --- a/packages/create-astro/src/actions/next-steps.ts +++ b/packages/create-astro/src/actions/next-steps.ts @@ -1,5 +1,5 @@ import path from 'node:path'; -import { Context } from './context'; +import type { Context } from './context'; import { nextSteps, say } from '../messages.js'; diff --git a/packages/integrations/image/src/lib/get-picture.ts b/packages/integrations/image/src/lib/get-picture.ts index 25bf104e8c..c25885dbf1 100644 --- a/packages/integrations/image/src/lib/get-picture.ts +++ b/packages/integrations/image/src/lib/get-picture.ts @@ -2,7 +2,7 @@ import mime from 'mime'; import { OutputFormat, parseAspectRatio, TransformOptions } from '../loaders/index.js'; import { extname } from '../utils/paths.js'; -import { ImageMetadata } from '../vite-plugin-astro-image.js'; +import type { ImageMetadata } from '../vite-plugin-astro-image.js'; import { getImage } from './get-image.js'; export interface GetPictureParams { diff --git a/packages/integrations/image/src/utils/metadata.ts b/packages/integrations/image/src/utils/metadata.ts index 715323d395..6440be40d9 100644 --- a/packages/integrations/image/src/utils/metadata.ts +++ b/packages/integrations/image/src/utils/metadata.ts @@ -1,8 +1,8 @@ import sizeOf from 'image-size'; import fs from 'node:fs/promises'; import { fileURLToPath } from 'node:url'; -import { InputFormat } from '../loaders/index.js'; -import { ImageMetadata } from '../vite-plugin-astro-image.js'; +import type { InputFormat } from '../loaders/index.js'; +import type { ImageMetadata } from '../vite-plugin-astro-image.js'; export interface Metadata extends ImageMetadata { orientation?: number; diff --git a/packages/integrations/image/src/utils/paths.ts b/packages/integrations/image/src/utils/paths.ts index ac6dccffc1..4592781ac9 100644 --- a/packages/integrations/image/src/utils/paths.ts +++ b/packages/integrations/image/src/utils/paths.ts @@ -1,4 +1,4 @@ -import { TransformOptions } from '../loaders/index.js'; +import type { TransformOptions } from '../loaders/index.js'; import { shorthash } from './shorthash.js'; export function isRemoteImage(src: string) { diff --git a/packages/integrations/markdoc/src/index.ts b/packages/integrations/markdoc/src/index.ts index d272af96ee..8543cf2605 100644 --- a/packages/integrations/markdoc/src/index.ts +++ b/packages/integrations/markdoc/src/index.ts @@ -3,7 +3,7 @@ import Markdoc from '@markdoc/markdoc'; import type { AstroConfig, AstroIntegration, ContentEntryType, HookParameters } from 'astro'; import fs from 'node:fs'; import { fileURLToPath } from 'node:url'; -import { InlineConfig } from 'vite'; +import type { InlineConfig } from 'vite'; import { getAstroConfigPath, MarkdocError, diff --git a/packages/integrations/mdx/src/index.ts b/packages/integrations/mdx/src/index.ts index fe8a61891b..1e64f5afa4 100644 --- a/packages/integrations/mdx/src/index.ts +++ b/packages/integrations/mdx/src/index.ts @@ -1,7 +1,7 @@ import { markdownConfigDefaults } from '@astrojs/markdown-remark'; import { toRemarkInitializeAstroData } from '@astrojs/markdown-remark/dist/internal.js'; import { compile as mdxCompile } from '@mdx-js/mdx'; -import { PluggableList } from '@mdx-js/mdx/lib/core.js'; +import type { PluggableList } from '@mdx-js/mdx/lib/core.js'; import mdxPlugin, { Options as MdxRollupPluginOptions } from '@mdx-js/rollup'; import type { AstroIntegration, ContentEntryType, HookParameters } from 'astro'; import { parse as parseESM } from 'es-module-lexer'; diff --git a/packages/integrations/mdx/src/plugins.ts b/packages/integrations/mdx/src/plugins.ts index fca2ce0a25..12b8f2bd3e 100644 --- a/packages/integrations/mdx/src/plugins.ts +++ b/packages/integrations/mdx/src/plugins.ts @@ -13,7 +13,7 @@ import rehypeRaw from 'rehype-raw'; import remarkGfm from 'remark-gfm'; import remarkSmartypants from 'remark-smartypants'; import type { VFile } from 'vfile'; -import { MdxOptions } from './index.js'; +import type { MdxOptions } from './index.js'; import { rehypeInjectHeadingsExport } from './rehype-collect-headings.js'; import rehypeMetaString from './rehype-meta-string.js'; import remarkPrism from './remark-prism.js'; diff --git a/packages/integrations/mdx/src/rehype-collect-headings.ts b/packages/integrations/mdx/src/rehype-collect-headings.ts index d7564b9418..69e3f9b1b0 100644 --- a/packages/integrations/mdx/src/rehype-collect-headings.ts +++ b/packages/integrations/mdx/src/rehype-collect-headings.ts @@ -1,4 +1,4 @@ -import { MarkdownHeading, MarkdownVFile } from '@astrojs/markdown-remark'; +import type { MarkdownHeading, MarkdownVFile } from '@astrojs/markdown-remark'; import { jsToTreeNode } from './utils.js'; export function rehypeInjectHeadingsExport() { diff --git a/packages/integrations/netlify/src/netlify-functions.ts b/packages/integrations/netlify/src/netlify-functions.ts index eb6ed76000..29f8db7358 100644 --- a/packages/integrations/netlify/src/netlify-functions.ts +++ b/packages/integrations/netlify/src/netlify-functions.ts @@ -1,6 +1,6 @@ import { polyfill } from '@astrojs/webapi'; import { builder, Handler } from '@netlify/functions'; -import { SSRManifest } from 'astro'; +import type { SSRManifest } from 'astro'; import { App } from 'astro/app'; polyfill(globalThis, { diff --git a/packages/integrations/node/src/preview.ts b/packages/integrations/node/src/preview.ts index 6f91a4d17d..86e37f0d1a 100644 --- a/packages/integrations/node/src/preview.ts +++ b/packages/integrations/node/src/preview.ts @@ -1,5 +1,5 @@ import type { CreatePreviewServer } from 'astro'; -import http from 'http'; +import type http from 'http'; import { fileURLToPath } from 'url'; import { createServer } from './http-server.js'; import type { createExports } from './server'; diff --git a/packages/integrations/preact/src/index.ts b/packages/integrations/preact/src/index.ts index 3a7a998568..4f4b0ee792 100644 --- a/packages/integrations/preact/src/index.ts +++ b/packages/integrations/preact/src/index.ts @@ -1,4 +1,4 @@ -import { AstroIntegration, AstroRenderer, ViteUserConfig } from 'astro'; +import type { AstroIntegration, AstroRenderer, ViteUserConfig } from 'astro'; function getRenderer(development: boolean): AstroRenderer { return { diff --git a/packages/integrations/react/src/index.ts b/packages/integrations/react/src/index.ts index 81d5b5da41..21ef3568cb 100644 --- a/packages/integrations/react/src/index.ts +++ b/packages/integrations/react/src/index.ts @@ -1,4 +1,4 @@ -import { AstroIntegration } from 'astro'; +import type { AstroIntegration } from 'astro'; import { version as ReactVersion } from 'react-dom'; function getRenderer() { diff --git a/packages/integrations/sitemap/src/generate-sitemap.ts b/packages/integrations/sitemap/src/generate-sitemap.ts index cb10bf2f6a..03985f08d0 100644 --- a/packages/integrations/sitemap/src/generate-sitemap.ts +++ b/packages/integrations/sitemap/src/generate-sitemap.ts @@ -1,4 +1,4 @@ -import { EnumChangefreq } from 'sitemap'; +import type { EnumChangefreq } from 'sitemap'; import type { SitemapItem, SitemapOptions } from './index.js'; import { parseUrl } from './utils/parse-url.js'; diff --git a/packages/markdown/remark/src/load-plugins.ts b/packages/markdown/remark/src/load-plugins.ts index abc93c122d..a3efd92a6f 100644 --- a/packages/markdown/remark/src/load-plugins.ts +++ b/packages/markdown/remark/src/load-plugins.ts @@ -1,6 +1,6 @@ import { resolve as importMetaResolve } from 'import-meta-resolve'; import path from 'path'; -import * as unified from 'unified'; +import type * as unified from 'unified'; import { pathToFileURL } from 'url'; const cwdUrlStr = pathToFileURL(path.join(process.cwd(), 'package.json')).toString(); diff --git a/packages/markdown/remark/src/rehype-collect-headings.ts b/packages/markdown/remark/src/rehype-collect-headings.ts index 19963cb80e..9e3c8005eb 100644 --- a/packages/markdown/remark/src/rehype-collect-headings.ts +++ b/packages/markdown/remark/src/rehype-collect-headings.ts @@ -1,7 +1,7 @@ -import { type Expression, type Super } from 'estree'; +import type { Expression, Super } from 'estree'; import Slugger from 'github-slugger'; -import { type MdxTextExpression } from 'mdast-util-mdx-expression'; -import { type Node } from 'unist'; +import type { MdxTextExpression } from 'mdast-util-mdx-expression'; +import type { Node } from 'unist'; import { visit } from 'unist-util-visit'; import { InvalidAstroDataError, safelyGetAstroData } from './frontmatter-injection.js'; diff --git a/tsconfig.base.json b/tsconfig.base.json index 52f7aedde0..d0bf130b8b 100644 --- a/tsconfig.base.json +++ b/tsconfig.base.json @@ -6,6 +6,7 @@ "moduleResolution": "node", "esModuleInterop": true, "skipLibCheck": true, - "forceConsistentCasingInFileNames": true + "forceConsistentCasingInFileNames": true, + "importsNotUsedAsValues": "error" } }