diff options
Diffstat (limited to 'packages/astro/src')
-rw-r--r-- | packages/astro/src/assets/services/squoosh.ts | 10 | ||||
-rw-r--r-- | packages/astro/src/core/config/vite-load.ts | 2 | ||||
-rw-r--r-- | packages/astro/src/core/sync/index.ts | 2 | ||||
-rw-r--r-- | packages/astro/src/env/vite-plugin-env.ts | 7 | ||||
-rw-r--r-- | packages/astro/src/integrations/features-validation.ts | 9 | ||||
-rw-r--r-- | packages/astro/src/integrations/hooks.ts | 4 | ||||
-rw-r--r-- | packages/astro/src/types/public/config.ts | 18 |
7 files changed, 35 insertions, 17 deletions
diff --git a/packages/astro/src/assets/services/squoosh.ts b/packages/astro/src/assets/services/squoosh.ts index 6eb78db4b..b98f831d2 100644 --- a/packages/astro/src/assets/services/squoosh.ts +++ b/packages/astro/src/assets/services/squoosh.ts @@ -1,5 +1,4 @@ -// TODO: Investigate removing this service once sharp lands WASM support, as libsquoosh is deprecated - +import { yellow } from 'kleur/colors'; import type { ImageOutputFormat, ImageQualityPreset } from '../types.js'; import { imageMetadata } from '../utils/metadata.js'; import { @@ -11,6 +10,13 @@ import { import { processBuffer } from './vendor/squoosh/image-pool.js'; import type { Operation } from './vendor/squoosh/image.js'; +// eslint-disable-next-line no-console +console.warn( + yellow( + 'The Squoosh image service is deprecated and will be removed in Astro 5.x. We suggest migrating to the default Sharp image service instead, as it is faster, more powerful and better maintained.', + ), +); + const baseQuality = { low: 25, mid: 50, high: 80, max: 100 }; const qualityTable: Record< Exclude<ImageOutputFormat, 'png' | 'svg'>, diff --git a/packages/astro/src/core/config/vite-load.ts b/packages/astro/src/core/config/vite-load.ts index a4e4852b7..8c953dde6 100644 --- a/packages/astro/src/core/config/vite-load.ts +++ b/packages/astro/src/core/config/vite-load.ts @@ -7,7 +7,7 @@ import { debug } from '../logger/core.js'; async function createViteServer(root: string, fs: typeof fsType): Promise<ViteDevServer> { const viteServer = await createServer({ configFile: false, - server: { middlewareMode: true, hmr: false, watch: null }, + server: { middlewareMode: true, hmr: false, watch: null, ws: false }, optimizeDeps: { noDiscovery: true }, clearScreen: false, appType: 'custom', diff --git a/packages/astro/src/core/sync/index.ts b/packages/astro/src/core/sync/index.ts index 02ab6bf9e..805a955bb 100644 --- a/packages/astro/src/core/sync/index.ts +++ b/packages/astro/src/core/sync/index.ts @@ -170,7 +170,7 @@ async function syncContentCollections( const tempViteServer = await createServer( await createVite( { - server: { middlewareMode: true, hmr: false, watch: null }, + server: { middlewareMode: true, hmr: false, watch: null, ws: false }, optimizeDeps: { noDiscovery: true }, ssr: { external: [] }, logLevel: 'silent', diff --git a/packages/astro/src/env/vite-plugin-env.ts b/packages/astro/src/env/vite-plugin-env.ts index 934ba79ca..b6d3194a6 100644 --- a/packages/astro/src/env/vite-plugin-env.ts +++ b/packages/astro/src/env/vite-plugin-env.ts @@ -31,7 +31,7 @@ export function astroEnv({ fs, sync, }: AstroEnvVirtualModPluginParams): Plugin | undefined { - if (!settings.config.experimental.env || sync) { + if (!settings.config.experimental.env) { return; } const schema = settings.config.experimental.env.schema ?? {}; @@ -57,6 +57,7 @@ export function astroEnv({ schema, loadedEnv, validateSecrets: settings.config.experimental.env?.validateSecrets ?? false, + sync, }); templates = { @@ -100,10 +101,12 @@ function validatePublicVariables({ schema, loadedEnv, validateSecrets, + sync, }: { schema: EnvSchema; loadedEnv: Record<string, string>; validateSecrets: boolean; + sync: boolean; }) { const valid: Array<{ key: string; value: any; type: string; context: 'server' | 'client' }> = []; const invalid: Array<InvalidVariable> = []; @@ -125,7 +128,7 @@ function validatePublicVariables({ } } - if (invalid.length > 0) { + if (invalid.length > 0 && !sync) { throw new AstroError({ ...AstroErrorData.EnvInvalidVariables, message: AstroErrorData.EnvInvalidVariables.message(invalidVariablesToError(invalid)), diff --git a/packages/astro/src/integrations/features-validation.ts b/packages/astro/src/integrations/features-validation.ts index 906559d61..3d1191953 100644 --- a/packages/astro/src/integrations/features-validation.ts +++ b/packages/astro/src/integrations/features-validation.ts @@ -118,20 +118,23 @@ function validateSupportKind( } function featureIsUnsupported(adapterName: string, logger: Logger, featureName: string) { - logger.error('config', `The feature "${featureName}" is not supported (used by ${adapterName}).`); + logger.error( + 'config', + `The adapter ${adapterName} doesn't currently support the feature "${featureName}".`, + ); } function featureIsExperimental(adapterName: string, logger: Logger, featureName: string) { logger.warn( 'config', - `The feature "${featureName}" is experimental and subject to change (used by ${adapterName}).`, + `The adapter ${adapterName} provides experimental support for "${featureName}". You may experience issues or breaking changes until this feature is fully supported by the adapter.`, ); } function featureIsDeprecated(adapterName: string, logger: Logger, featureName: string) { logger.warn( 'config', - `The feature "${featureName}" is deprecated and will be removed in the future (used by ${adapterName}).`, + `The adapter ${adapterName} has deprecated its support for "${featureName}", and future compatibility is not guaranteed. The adapter may completely remove support for this feature without warning.`, ); } diff --git a/packages/astro/src/integrations/hooks.ts b/packages/astro/src/integrations/hooks.ts index 9bf77f146..1dc681db6 100644 --- a/packages/astro/src/integrations/hooks.ts +++ b/packages/astro/src/integrations/hooks.ts @@ -345,7 +345,9 @@ export async function runHookConfigDone({ content: injectedType.content, }); - return new URL(normalizedFilename, settings.config.root); + // It must be relative to dotAstroDir here and not inside normalizeInjectedTypeFilename + // because injectedTypes are handled relatively to the dotAstroDir already + return new URL(normalizedFilename, settings.dotAstroDir); }, logger: getLogger(integration, logger), }), diff --git a/packages/astro/src/types/public/config.ts b/packages/astro/src/types/public/config.ts index 70f13e9a5..353e24115 100644 --- a/packages/astro/src/types/public/config.ts +++ b/packages/astro/src/types/public/config.ts @@ -1908,6 +1908,10 @@ export interface AstroUserConfig { * export const collections = { blog, dogs }; * ``` * + * :::note + * Loaders will not automatically [exclude files prefaced with an `_`](/en/guides/routing/#excluding-pages). Use a regular expression such as `pattern: '**\/[^_]*.md` in your loader to ignore these files. + * ::: + * * #### Querying and rendering with the Content Layer API * * The collection can be [queried in the same way as content collections](/en/guides/content-collections/#querying-collections): @@ -1988,8 +1992,8 @@ export interface AstroUserConfig { * * const blog = defineCollection({ * // For content layer you no longer define a `type` - * type: 'content', - * loader: glob({ pattern: "**\/*.md", base: "./src/data/blog" }), + * type: 'content', + * loader: glob({ pattern: '**\/[^_]*.md', base: "./src/data/blog" }), * schema: z.object({ * title: z.string(), * description: z.string(), @@ -2020,13 +2024,13 @@ export interface AstroUserConfig { * ```astro ins={4,9} del={3,8} * // src/pages/index.astro * --- - * import { getEntry } from 'astro:content'; - * import { getEntry, render } from 'astro:content'; + * import { getEntry } from 'astro:content'; + * import { getEntry, render } from 'astro:content'; * - * const post = await getEntry('blog', params.slug); + * const post = await getEntry('blog', params.slug); * - * const { Content, headings } = await post.render(); - * const { Content, headings } = await render(post); + * const { Content, headings } = await post.render(); + * const { Content, headings } = await render(post); * --- * * <Content /> |