diff --git a/packages/astro/src/core/config/config.ts b/packages/astro/src/core/config/config.ts index dc4e7bcd90..13c87fa9ac 100644 --- a/packages/astro/src/core/config/config.ts +++ b/packages/astro/src/core/config/config.ts @@ -9,10 +9,10 @@ import path from 'path'; import { fileURLToPath, pathToFileURL } from 'url'; import * as vite from 'vite'; import { mergeConfig as mergeViteConfig } from 'vite'; +import { AstroError, AstroErrorData } from '../errors/index.js'; import { LogOptions } from '../logger/core.js'; import { arraify, isObject, isURL } from '../util.js'; import { createRelativeSchema } from './schema.js'; -import { AstroError, AstroErrorData } from '../errors/index.js'; load.use([loadTypeScript]); diff --git a/packages/astro/src/core/endpoint/index.ts b/packages/astro/src/core/endpoint/index.ts index e6d24802df..a957ef9a7c 100644 --- a/packages/astro/src/core/endpoint/index.ts +++ b/packages/astro/src/core/endpoint/index.ts @@ -4,8 +4,8 @@ import type { Environment, RenderContext } from '../render/index'; import { renderEndpoint } from '../../runtime/server/index.js'; import { ASTRO_VERSION } from '../constants.js'; import { AstroCookies, attachToResponse } from '../cookies/index.js'; -import { getParamsAndProps, GetParamsAndPropsError } from '../render/core.js'; import { AstroError, AstroErrorData } from '../errors/index.js'; +import { getParamsAndProps, GetParamsAndPropsError } from '../render/core.js'; const clientAddressSymbol = Symbol.for('astro.clientAddress'); diff --git a/packages/astro/src/core/errors/dev/utils.ts b/packages/astro/src/core/errors/dev/utils.ts index 510e5fa51e..54f1868bc5 100644 --- a/packages/astro/src/core/errors/dev/utils.ts +++ b/packages/astro/src/core/errors/dev/utils.ts @@ -25,7 +25,6 @@ export function collectErrorMetadata(e: any, rootFolder?: URL | undefined): Erro error = collectInfoFromStacktrace(e); } - if (error.loc?.file && rootFolder && !error.loc.file.startsWith('/')) { error.loc.file = join(fileURLToPath(rootFolder), error.loc.file); } diff --git a/packages/astro/src/core/render/core.ts b/packages/astro/src/core/render/core.ts index b41fe045f7..b43d21d27c 100644 --- a/packages/astro/src/core/render/core.ts +++ b/packages/astro/src/core/render/core.ts @@ -5,10 +5,10 @@ import type { Environment } from './environment.js'; import { Fragment, renderPage as runtimeRenderPage } from '../../runtime/server/index.js'; import { attachToResponse } from '../cookies/index.js'; +import { AstroError, AstroErrorData } from '../errors/index.js'; import { getParams } from '../routing/params.js'; import { createResult } from './result.js'; import { callGetStaticPaths, findPathItemByKey, RouteCache } from './route-cache.js'; -import { AstroError, AstroErrorData } from '../errors/index.js'; interface GetParamsAndPropsOptions { mod: ComponentInstance; diff --git a/packages/astro/src/vite-plugin-astro-server/route.ts b/packages/astro/src/vite-plugin-astro-server/route.ts index 234c28b8d8..aab47ecc74 100644 --- a/packages/astro/src/vite-plugin-astro-server/route.ts +++ b/packages/astro/src/vite-plugin-astro-server/route.ts @@ -6,6 +6,7 @@ import { DevelopmentEnvironment, SSROptions } from '../core/render/dev/index'; import { attachToResponse } from '../core/cookies/index.js'; import { call as callEndpoint } from '../core/endpoint/dev/index.js'; import { throwIfRedirectNotAllowed } from '../core/endpoint/index.js'; +import { AstroErrorData } from '../core/errors/index.js'; import { warn } from '../core/logger/core.js'; import { appendForwardSlash } from '../core/path.js'; import { preload, renderPage } from '../core/render/dev/index.js'; @@ -15,7 +16,6 @@ import { matchAllRoutes } from '../core/routing/index.js'; import { resolvePages } from '../core/util.js'; import { log404 } from './common.js'; import { handle404Response, writeSSRResult, writeWebResponse } from './response.js'; -import { AstroErrorData } from '../core/errors/index.js'; type AsyncReturnType Promise> = T extends ( ...args: any