diff --git a/.github/labeler.yml b/.github/labeler.yml index c1025ad117d1..b0d27800ba97 100644 --- a/.github/labeler.yml +++ b/.github/labeler.yml @@ -40,5 +40,5 @@ - packages/integrations/vue/** 'docs pr': -- packages/astro/src/@types/astro.ts +- packages/astro/src/types/public/** - packages/astro/src/core/errors/errors-data.ts diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index c1b4919901ab..2ce9ac1dbd53 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -11,7 +11,7 @@ on: - "examples/**" - ".github/workflows/check.yml" - "scripts/smoke/check.js" - - "packages/astro/src/@types/astro.ts" + - "packages/astro/src/types/public/**" - "pnpm-lock.yaml" - "packages/astro/types.d.ts" diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 79962c07e1ce..d516ab47a93f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -229,7 +229,7 @@ jobs: filters: | docs: - 'packages/integrations/*/README.md' - - 'packages/astro/src/@types/astro.ts' + - "packages/astro/src/types/public/**" - 'packages/astro/src/core/errors/errors-data.ts' - name: Build autogenerated docs pages from current astro branch diff --git a/packages/astro/components/Picture.astro b/packages/astro/components/Picture.astro index c85548404d29..6686faf15bbe 100644 --- a/packages/astro/components/Picture.astro +++ b/packages/astro/components/Picture.astro @@ -1,7 +1,7 @@ --- import { type LocalImageProps, type RemoteImageProps, getImage } from 'astro:assets'; import * as mime from 'mrmime'; -import type { GetImageResult, ImageOutputFormat } from '../dist/@types/astro'; +import type { GetImageResult, ImageOutputFormat } from '../dist/types/public/index.js'; import { isESMImportedImage, resolveSrc } from '../dist/assets/utils/imageKind'; import { AstroError, AstroErrorData } from '../dist/core/errors/index.js'; import type { HTMLAttributes } from '../types'; diff --git a/packages/astro/config.d.ts b/packages/astro/config.d.ts index 9f4c6bfd112d..675c783a191d 100644 --- a/packages/astro/config.d.ts +++ b/packages/astro/config.d.ts @@ -1,8 +1,8 @@ type ViteUserConfig = import('vite').UserConfig; type ViteUserConfigFn = import('vite').UserConfigFn; -type AstroUserConfig = import('./dist/@types/astro.js').AstroUserConfig; -type AstroInlineConfig = import('./dist/@types/astro.js').AstroInlineConfig; -type ImageServiceConfig = import('./dist/@types/astro.js').ImageServiceConfig; +type AstroUserConfig = import('./dist/types/public/config.js').AstroUserConfig; +type AstroInlineConfig = import('./dist/types/public/config.js').AstroInlineConfig; +type ImageServiceConfig = import('./dist/types/public/config.js').ImageServiceConfig; type SharpImageServiceConfig = import('./dist/assets/services/sharp.js').SharpImageServiceConfig; type EnvField = typeof import('./dist/env/config.js').envField; @@ -42,4 +42,4 @@ export function passthroughImageService(): ImageServiceConfig; /** * Return a valid env field to use in this Astro config for `experimental.env.schema`. */ -export const envField: EnvField; +export declare const envField: EnvField; diff --git a/packages/astro/src/core/create-vite.ts b/packages/astro/src/core/create-vite.ts index bb9179694168..f2931523a6ed 100644 --- a/packages/astro/src/core/create-vite.ts +++ b/packages/astro/src/core/create-vite.ts @@ -185,7 +185,7 @@ export async function createVite( { // Typings are imported from 'astro' (e.g. import { Type } from 'astro') find: /^astro$/, - replacement: fileURLToPath(new URL('../@types/astro.js', import.meta.url)), + replacement: fileURLToPath(new URL('../types/public/index.js', import.meta.url)), }, { find: 'astro:middleware', diff --git a/packages/astro/src/core/errors/errors-data.ts b/packages/astro/src/core/errors/errors-data.ts index aa19b6dc3b0e..9359a401bc8d 100644 --- a/packages/astro/src/core/errors/errors-data.ts +++ b/packages/astro/src/core/errors/errors-data.ts @@ -1,5 +1,5 @@ // BEFORE ADDING AN ERROR: Please look at the README.md in this folder for general guidelines on writing error messages -// Additionally, this code, much like `@types/astro.ts`, is used to generate documentation, so make sure to pass +// Additionally, this code, much like `types/public/config.ts`, is used to generate documentation, so make sure to pass // your changes by our wonderful docs team before merging! import type { ZodError } from 'zod'; diff --git a/packages/astro/templates/actions.mjs b/packages/astro/templates/actions.mjs index 587f6ed9b7c1..823699e15e65 100644 --- a/packages/astro/templates/actions.mjs +++ b/packages/astro/templates/actions.mjs @@ -55,7 +55,7 @@ function toActionProxy(actionCallback = {}, aggregatedPath = '') { /** * @param {*} param argument passed to the action when called server or client-side. * @param {string} path Built path to call action by path name. - * @param {import('../dist/@types/astro.d.ts').APIContext | undefined} context Injected API context when calling actions from the server. + * @param {import('../dist/types/public/context.js').APIContext | undefined} context Injected API context when calling actions from the server. * Usage: `actions.[name](param)`. * @returns {Promise>} */ diff --git a/packages/astro/test/core-image-unconventional-settings.test.js b/packages/astro/test/core-image-unconventional-settings.test.js index edbfab6f6343..b5d5fc6640de 100644 --- a/packages/astro/test/core-image-unconventional-settings.test.js +++ b/packages/astro/test/core-image-unconventional-settings.test.js @@ -6,7 +6,7 @@ import { testImageService } from './test-image-service.js'; import { loadFixture } from './test-utils.js'; /** - ** @typedef {import('../src/@types/astro').AstroInlineConfig & { root?: string | URL }} AstroInlineConfig + ** @typedef {import('../src/types/public/config.js').AstroInlineConfig & { root?: string | URL }} AstroInlineConfig */ /** @type {AstroInlineConfig} */ diff --git a/packages/astro/test/fixtures/core-image-ssr/src/pages/api.ts b/packages/astro/test/fixtures/core-image-ssr/src/pages/api.ts index 261fb6bb7dc7..25777dce8adb 100644 --- a/packages/astro/test/fixtures/core-image-ssr/src/pages/api.ts +++ b/packages/astro/test/fixtures/core-image-ssr/src/pages/api.ts @@ -1,4 +1,4 @@ -import type { APIRoute } from "../../../../../src/@types/astro"; +import type { APIRoute } from "astro" export const GET = (async ({ params, request }) => { const url = new URL(request.url); diff --git a/packages/astro/test/fixtures/ssr-prerender-chunks/deps/test-adapter/index.js b/packages/astro/test/fixtures/ssr-prerender-chunks/deps/test-adapter/index.js index 82b7b64b1fc9..06eb02e2c6ce 100644 --- a/packages/astro/test/fixtures/ssr-prerender-chunks/deps/test-adapter/index.js +++ b/packages/astro/test/fixtures/ssr-prerender-chunks/deps/test-adapter/index.js @@ -1,6 +1,6 @@ /** * - * @returns {import('../src/@types/astro').AstroIntegration} + * @returns {import('../../../../../src/types/public/integrations.js').AstroIntegration} */ export default function () { return { @@ -82,4 +82,4 @@ export default function () { }, }, }; -} \ No newline at end of file +} diff --git a/packages/astro/test/test-adapter.js b/packages/astro/test/test-adapter.js index 8c4643367d20..5a8bce2df478 100644 --- a/packages/astro/test/test-adapter.js +++ b/packages/astro/test/test-adapter.js @@ -1,11 +1,11 @@ import { viteID } from '../dist/core/util.js'; /** - * @typedef {import('../src/@types/astro.js').AstroAdapter} AstroAdapter - * @typedef {import('../src/@types/astro.js').AstroIntegration} AstroIntegration - * @typedef {import('../src/@types/astro.js').HookParameters<"astro:build:ssr">['entryPoints']} EntryPoints - * @typedef {import('../src/@types/astro.js').HookParameters<"astro:build:ssr">['middlewareEntryPoint']} MiddlewareEntryPoint - * @typedef {import('../src/@types/astro.js').HookParameters<"astro:build:done">['routes']} Routes + * @typedef {import('../src/types/public/integrations.js').AstroAdapter} AstroAdapter + * @typedef {import('../src/types/public/integrations.js').AstroIntegration} AstroIntegration + * @typedef {import('../src/types/public/integrations.js').HookParameters<"astro:build:ssr">['entryPoints']} EntryPoints + * @typedef {import('../src/types/public/integrations.js').HookParameters<"astro:build:ssr">['middlewareEntryPoint']} MiddlewareEntryPoint + * @typedef {import('../src/types/public/integrations.js').HookParameters<"astro:build:done">['routes']} Routes */ /** diff --git a/packages/astro/test/test-image-service.js b/packages/astro/test/test-image-service.js index 35a5fa2c8625..de076425cd9a 100644 --- a/packages/astro/test/test-image-service.js +++ b/packages/astro/test/test-image-service.js @@ -12,7 +12,7 @@ export function testImageService(config = {}) { }; } -/** @type {import("../dist/@types/astro").LocalImageService} */ +/** @type {import("../dist/types/public/index.js").LocalImageService} */ export default { ...baseService, propertiesToHash: [...baseService.propertiesToHash, 'data-custom'], diff --git a/packages/astro/test/test-utils.js b/packages/astro/test/test-utils.js index 95edeebd2673..115f3c2d5f2e 100644 --- a/packages/astro/test/test-utils.js +++ b/packages/astro/test/test-utils.js @@ -23,8 +23,8 @@ process.env.ASTRO_TELEMETRY_DISABLED = true; /** * @typedef {import('../src/core/dev/dev').DevServer} DevServer - * @typedef {import('../src/@types/astro').AstroInlineConfig & { root?: string | URL }} AstroInlineConfig - * @typedef {import('../src/@types/astro').AstroConfig} AstroConfig + * @typedef {import('../src/types/public/config.js').AstroInlineConfig & { root?: string | URL }} AstroInlineConfig + * @typedef {import('../src/types/public/config.js').AstroConfig} AstroConfig * @typedef {import('../src/core/preview/index').PreviewServer} PreviewServer * @typedef {import('../src/core/app/index').App} App * @typedef {import('../src/cli/check/index').AstroChecker} AstroChecker diff --git a/packages/astro/test/types/call-action.ts b/packages/astro/test/types/call-action.ts index 91610558586f..8cadd1fb06e6 100644 --- a/packages/astro/test/types/call-action.ts +++ b/packages/astro/test/types/call-action.ts @@ -1,6 +1,6 @@ import { describe, it } from 'node:test'; import { expectTypeOf } from 'expect-type'; -import type { APIContext } from '../../dist/@types/astro.js'; +import type { APIContext } from '../../dist/types/public/context.js'; import { type ActionReturnType, defineAction } from '../../dist/actions/runtime/virtual/server.js'; import { z } from '../../zod.mjs'; diff --git a/packages/astro/test/units/test-utils.js b/packages/astro/test/units/test-utils.js index bab850b68530..a104ef2a40a2 100644 --- a/packages/astro/test/units/test-utils.js +++ b/packages/astro/test/units/test-utils.js @@ -211,8 +211,8 @@ export function createBasicPipeline(options = {}) { } /** - * @param {import('../../src/@types/astro.js').AstroInlineConfig} inlineConfig - * @returns {Promise} + * @param {import('../../src/types/public/config.js').AstroInlineConfig} inlineConfig + * @returns {Promise} */ export async function createBasicSettings(inlineConfig = {}) { if (!inlineConfig.root) { @@ -225,7 +225,7 @@ export async function createBasicSettings(inlineConfig = {}) { /** * @typedef {{ * fs?: typeof realFS, - * inlineConfig?: import('../../src/@types/astro.js').AstroInlineConfig, + * inlineConfig?: import('../../src/types/public/config.js').AstroInlineConfig, * logging?: import('../../src/core/logger/core').LogOptions, * }} RunInContainerOptions */ diff --git a/packages/integrations/node/test/api-route.test.js b/packages/integrations/node/test/api-route.test.js index 804a5ccf4797..9743ce42d51c 100644 --- a/packages/integrations/node/test/api-route.test.js +++ b/packages/integrations/node/test/api-route.test.js @@ -7,7 +7,7 @@ import { createRequestAndResponse, loadFixture } from './test-utils.js'; describe('API routes', () => { /** @type {import('./test-utils').Fixture} */ let fixture; - /** @type {import('astro/src/@types/astro.js').PreviewServer} */ + /** @type {import('../../../astro/src/types/public/preview.js').PreviewServer} */ let previewServer; /** @type {URL} */ let baseUri;