summaryrefslogtreecommitdiff
path: root/packages/astro
diff options
context:
space:
mode:
Diffstat (limited to 'packages/astro')
-rw-r--r--packages/astro/CHANGELOG.md16
-rw-r--r--packages/astro/e2e/fixtures/actions-blog/package.json4
-rw-r--r--packages/astro/e2e/fixtures/actions-react-19/package.json2
-rw-r--r--packages/astro/e2e/fixtures/server-islands/package.json2
-rw-r--r--packages/astro/e2e/fixtures/tailwindcss/package.json2
-rw-r--r--packages/astro/e2e/fixtures/view-transitions/package.json2
-rw-r--r--packages/astro/package.json14
-rw-r--r--packages/astro/performance/fixtures/md/package.json2
-rw-r--r--packages/astro/performance/fixtures/mdoc/package.json2
-rw-r--r--packages/astro/performance/fixtures/mdx/package.json2
-rw-r--r--packages/astro/src/cli/add/index.ts12
-rw-r--r--packages/astro/src/content/content-layer.ts14
-rw-r--r--packages/astro/src/content/data-store.ts1
-rw-r--r--packages/astro/src/content/loaders/glob.ts15
-rw-r--r--packages/astro/src/content/mutable-data-store.ts29
-rw-r--r--packages/astro/src/core/errors/README.md28
-rw-r--r--packages/astro/src/core/errors/errors-data.ts87
-rw-r--r--packages/astro/src/types/public/config.ts4
-rw-r--r--packages/astro/test/content-layer.test.js4
-rw-r--r--packages/astro/test/fixtures/client-address-node/package.json2
-rw-r--r--packages/astro/test/fixtures/content-layer/content-outside-src/columbia-copy.md1
-rw-r--r--packages/astro/test/fixtures/content-layer/src/content/config.ts3
-rw-r--r--packages/astro/test/fixtures/content-layer/src/pages/collections.json.js1
-rw-r--r--packages/astro/test/fixtures/custom-assets-name/package.json2
-rw-r--r--packages/astro/test/fixtures/postcss/package.json2
-rw-r--r--packages/astro/test/fixtures/ssr-api-route/package.json2
-rw-r--r--packages/astro/test/fixtures/ssr-prerender-chunks/package.json2
-rw-r--r--packages/astro/test/fixtures/static-build-ssr/package.json2
-rw-r--r--packages/astro/test/fixtures/tailwindcss-ts/package.json2
-rw-r--r--packages/astro/test/fixtures/tailwindcss/package.json2
30 files changed, 114 insertions, 149 deletions
diff --git a/packages/astro/CHANGELOG.md b/packages/astro/CHANGELOG.md
index f662bb51f..53189df28 100644
--- a/packages/astro/CHANGELOG.md
+++ b/packages/astro/CHANGELOG.md
@@ -88,6 +88,22 @@
As this is a potentially breaking change to your script behavior, please review your `<script>` tags and ensure that they behave as expected.
+## 4.15.2
+
+### Patch Changes
+
+- [#11870](https://github.com/withastro/astro/pull/11870) [`8e5257a`](https://github.com/withastro/astro/commit/8e5257addaeff809ed6f0c47ac0ed4ded755320e) Thanks [@ArmandPhilippot](https://github.com/ArmandPhilippot)! - Fixes typo in documenting the `fallbackType` property in i18n routing
+
+- [#11884](https://github.com/withastro/astro/pull/11884) [`e450704`](https://github.com/withastro/astro/commit/e45070459f18976400fc8939812e172781eba351) Thanks [@ascorbic](https://github.com/ascorbic)! - Correctly handles content layer data where the transformed value does not match the input schema
+
+- [#11900](https://github.com/withastro/astro/pull/11900) [`80b4a18`](https://github.com/withastro/astro/commit/80b4a181a077266c44065a737e61cc7cff6bc6d7) Thanks [@delucis](https://github.com/delucis)! - Fixes the user-facing type of the new `i18n.routing.fallbackType` option to be optional
+
+## 4.15.1
+
+### Patch Changes
+
+- [#11872](https://github.com/withastro/astro/pull/11872) [`9327d56`](https://github.com/withastro/astro/commit/9327d56755404b481993b058bbfc4aa7880b2304) Thanks [@bluwy](https://github.com/bluwy)! - Fixes `astro add` importing adapters and integrations
+
- [#11767](https://github.com/withastro/astro/pull/11767) [`d1bd1a1`](https://github.com/withastro/astro/commit/d1bd1a11f7aca4d2141d1c4665f2db0440393d03) Thanks [@ascorbic](https://github.com/ascorbic)! - Refactors content layer sync to use a queue
## 4.15.0
diff --git a/packages/astro/e2e/fixtures/actions-blog/package.json b/packages/astro/e2e/fixtures/actions-blog/package.json
index 545ae2d37..1bb4b4557 100644
--- a/packages/astro/e2e/fixtures/actions-blog/package.json
+++ b/packages/astro/e2e/fixtures/actions-blog/package.json
@@ -12,9 +12,9 @@
"dependencies": {
"@astrojs/check": "^0.9.3",
"@astrojs/db": "workspace:*",
- "@astrojs/node": "workspace:*",
+ "@astrojs/node": "^8.3.3",
"@astrojs/react": "workspace:*",
- "@types/react": "^18.3.4",
+ "@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"astro": "workspace:*",
"react": "^18.3.1",
diff --git a/packages/astro/e2e/fixtures/actions-react-19/package.json b/packages/astro/e2e/fixtures/actions-react-19/package.json
index aa5fa90dd..ef6b4fe6a 100644
--- a/packages/astro/e2e/fixtures/actions-react-19/package.json
+++ b/packages/astro/e2e/fixtures/actions-react-19/package.json
@@ -12,7 +12,7 @@
"dependencies": {
"@astrojs/check": "^0.9.3",
"@astrojs/db": "workspace:*",
- "@astrojs/node": "workspace:*",
+ "@astrojs/node": "^8.3.3",
"@astrojs/react": "workspace:*",
"@types/react": "npm:types-react",
"@types/react-dom": "npm:types-react-dom",
diff --git a/packages/astro/e2e/fixtures/server-islands/package.json b/packages/astro/e2e/fixtures/server-islands/package.json
index 9958ee287..efbfeec68 100644
--- a/packages/astro/e2e/fixtures/server-islands/package.json
+++ b/packages/astro/e2e/fixtures/server-islands/package.json
@@ -9,7 +9,7 @@
"@astrojs/react": "workspace:*",
"astro": "workspace:*",
"@astrojs/mdx": "workspace:*",
- "@astrojs/node": "workspace:*",
+ "@astrojs/node": "^8.3.3",
"react": "^18.3.1",
"react-dom": "^18.3.1"
}
diff --git a/packages/astro/e2e/fixtures/tailwindcss/package.json b/packages/astro/e2e/fixtures/tailwindcss/package.json
index 599bca6ac..14d4c210b 100644
--- a/packages/astro/e2e/fixtures/tailwindcss/package.json
+++ b/packages/astro/e2e/fixtures/tailwindcss/package.json
@@ -6,7 +6,7 @@
"@astrojs/tailwind": "workspace:*",
"astro": "workspace:*",
"autoprefixer": "^10.4.20",
- "postcss": "^8.4.41",
+ "postcss": "^8.4.43",
"tailwindcss": "^3.4.10"
}
}
diff --git a/packages/astro/e2e/fixtures/view-transitions/package.json b/packages/astro/e2e/fixtures/view-transitions/package.json
index 0a0ad81f2..e40816ffd 100644
--- a/packages/astro/e2e/fixtures/view-transitions/package.json
+++ b/packages/astro/e2e/fixtures/view-transitions/package.json
@@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"dependencies": {
- "@astrojs/node": "workspace:*",
+ "@astrojs/node": "^8.3.3",
"@astrojs/react": "workspace:*",
"@astrojs/svelte": "workspace:*",
"@astrojs/vue": "workspace:*",
diff --git a/packages/astro/package.json b/packages/astro/package.json
index 7afc28f56..d9c2cb04f 100644
--- a/packages/astro/package.json
+++ b/packages/astro/package.json
@@ -169,15 +169,15 @@
"prompts": "^2.4.2",
"rehype": "^13.0.1",
"semver": "^7.6.3",
- "shiki": "^1.14.1",
+ "shiki": "^1.16.1",
"string-width": "^7.2.0",
"strip-ansi": "^7.1.0",
"tinyexec": "^0.3.0",
- "tsconfck": "^3.1.1",
+ "tsconfck": "^3.1.3",
"unist-util-visit": "^5.0.0",
"vfile": "^6.0.3",
"vite": "^5.4.2",
- "vitefu": "^0.2.5",
+ "vitefu": "^1.0.2",
"which-pm": "^3.0.0",
"xxhash-wasm": "^1.0.2",
"yargs-parser": "^21.1.1",
@@ -192,12 +192,10 @@
"@astrojs/check": "^0.9.3",
"@playwright/test": "^1.46.1",
"@types/aria-query": "^5.0.4",
- "@types/babel__generator": "^7.6.8",
- "@types/babel__traverse": "^7.20.6",
"@types/common-ancestor-path": "^1.0.2",
"@types/cssesc": "^3.0.2",
"@types/debug": "^4.1.12",
- "@types/diff": "^5.2.1",
+ "@types/diff": "^5.2.2",
"@types/dlv": "^1.1.4",
"@types/dom-view-transitions": "^1.0.5",
"@types/hast": "^3.0.4",
@@ -210,7 +208,7 @@
"@types/yargs-parser": "^21.0.3",
"astro-scripts": "workspace:*",
"cheerio": "1.0.0",
- "eol": "^0.9.1",
+ "eol": "^0.10.0",
"execa": "^8.0.1",
"expect-type": "^0.20.0",
"mdast-util-mdx": "^3.0.0",
@@ -222,7 +220,7 @@
"rehype-slug": "^6.0.0",
"rehype-toc": "^3.0.2",
"remark-code-titles": "^0.1.2",
- "rollup": "^4.21.1",
+ "rollup": "^4.21.2",
"sass": "^1.77.8",
"undici": "^6.19.8",
"unified": "^11.0.5"
diff --git a/packages/astro/performance/fixtures/md/package.json b/packages/astro/performance/fixtures/md/package.json
index 90db727e4..76ea90312 100644
--- a/packages/astro/performance/fixtures/md/package.json
+++ b/packages/astro/performance/fixtures/md/package.json
@@ -16,7 +16,7 @@
"dependencies": {
"@astrojs/react": "workspace:*",
"@performance/utils": "workspace:*",
- "@types/react": "^18.3.4",
+ "@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"astro": "workspace:*",
"react": "^18.3.1",
diff --git a/packages/astro/performance/fixtures/mdoc/package.json b/packages/astro/performance/fixtures/mdoc/package.json
index 5bcd443ae..115798883 100644
--- a/packages/astro/performance/fixtures/mdoc/package.json
+++ b/packages/astro/performance/fixtures/mdoc/package.json
@@ -17,7 +17,7 @@
"@astrojs/markdoc": "workspace:*",
"@astrojs/react": "workspace:*",
"@performance/utils": "workspace:*",
- "@types/react": "^18.3.4",
+ "@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"astro": "workspace:*",
"react": "^18.3.1",
diff --git a/packages/astro/performance/fixtures/mdx/package.json b/packages/astro/performance/fixtures/mdx/package.json
index e1fc69d0d..a634aac45 100644
--- a/packages/astro/performance/fixtures/mdx/package.json
+++ b/packages/astro/performance/fixtures/mdx/package.json
@@ -17,7 +17,7 @@
"@astrojs/mdx": "workspace:*",
"@astrojs/react": "workspace:*",
"@performance/utils": "workspace:*",
- "@types/react": "^18.3.4",
+ "@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"astro": "workspace:*",
"react": "^18.3.1",
diff --git a/packages/astro/src/cli/add/index.ts b/packages/astro/src/cli/add/index.ts
index 2b230048c..f263904cb 100644
--- a/packages/astro/src/cli/add/index.ts
+++ b/packages/astro/src/cli/add/index.ts
@@ -427,7 +427,11 @@ function addIntegration(mod: ProxifiedModule<any>, integration: IntegrationInfo)
const integrationId = toIdent(integration.id);
if (!mod.imports.$items.some((imp) => imp.local === integrationId)) {
- mod.imports.$append({ imported: integrationId, from: integration.packageName });
+ mod.imports.$append({
+ imported: 'default',
+ local: integrationId,
+ from: integration.packageName,
+ });
}
config.integrations ??= [];
@@ -448,7 +452,11 @@ export function setAdapter(mod: ProxifiedModule<any>, adapter: IntegrationInfo)
const adapterId = toIdent(adapter.id);
if (!mod.imports.$items.some((imp) => imp.local === adapterId)) {
- mod.imports.$append({ imported: adapterId, from: adapter.packageName });
+ mod.imports.$append({
+ imported: 'default',
+ local: adapterId,
+ from: adapter.packageName,
+ });
}
if (!config.output) {
diff --git a/packages/astro/src/content/content-layer.ts b/packages/astro/src/content/content-layer.ts
index 1dd86267b..fd1aeca18 100644
--- a/packages/astro/src/content/content-layer.ts
+++ b/packages/astro/src/content/content-layer.ts
@@ -1,6 +1,4 @@
import { promises as fs, existsSync } from 'node:fs';
-import { isAbsolute } from 'node:path';
-import { fileURLToPath } from 'node:url';
import * as fastq from 'fastq';
import type { FSWatcher } from 'vite';
import xxhash from 'xxhash-wasm';
@@ -20,7 +18,6 @@ import {
getEntryConfigByExtMap,
getEntryDataAndImages,
globalContentConfigObserver,
- posixRelative,
} from './utils.js';
export interface ContentLayerOptions {
@@ -189,7 +186,7 @@ export class ContentLayer {
const collectionWithResolvedSchema = { ...collection, schema };
const parseData: LoaderContext['parseData'] = async ({ id, data, filePath = '' }) => {
- const { imageImports, data: parsedData } = await getEntryDataAndImages(
+ const { data: parsedData } = await getEntryDataAndImages(
{
id,
collection: name,
@@ -202,15 +199,6 @@ export class ContentLayer {
collectionWithResolvedSchema,
false,
);
- if (imageImports?.length) {
- this.#store.addAssetImports(
- imageImports,
- // This path may already be relative, if we're re-parsing an existing entry
- isAbsolute(filePath)
- ? posixRelative(fileURLToPath(this.#settings.config.root), filePath)
- : filePath,
- );
- }
return parsedData;
};
diff --git a/packages/astro/src/content/data-store.ts b/packages/astro/src/content/data-store.ts
index 76cefc411..fbf31d0f1 100644
--- a/packages/astro/src/content/data-store.ts
+++ b/packages/astro/src/content/data-store.ts
@@ -33,6 +33,7 @@ export interface DataEntry<TData extends Record<string, unknown> = Record<string
* If an entry is a deferred, its rendering phase is delegated to a virtual module during the runtime phase when calling `renderEntry`.
*/
deferredRender?: boolean;
+ assetImports?: Array<string>;
}
/**
diff --git a/packages/astro/src/content/loaders/glob.ts b/packages/astro/src/content/loaders/glob.ts
index 122bb0477..9c3475f34 100644
--- a/packages/astro/src/content/loaders/glob.ts
+++ b/packages/astro/src/content/loaders/glob.ts
@@ -107,15 +107,11 @@ export function glob(globOptions: GlobOptions): Loader {
store.addModuleImport(existingEntry.filePath);
}
- if (existingEntry.rendered?.metadata?.imagePaths?.length) {
+ if (existingEntry.assetImports?.length) {
// Add asset imports for existing entries
- store.addAssetImports(
- existingEntry.rendered.metadata.imagePaths,
- existingEntry.filePath,
- );
+ store.addAssetImports(existingEntry.assetImports, existingEntry.filePath);
}
- // Re-parsing to resolve images and other effects
- await parseData(existingEntry);
+
return;
}
@@ -156,10 +152,9 @@ export function glob(globOptions: GlobOptions): Loader {
filePath: relativePath,
digest,
rendered,
+ assetImports: rendered?.metadata?.imagePaths,
});
- if (rendered?.metadata?.imagePaths?.length) {
- store.addAssetImports(rendered.metadata.imagePaths, relativePath);
- }
+
// todo: add an explicit way to opt in to deferred rendering
} else if ('contentModuleTypes' in entryType) {
store.set({
diff --git a/packages/astro/src/content/mutable-data-store.ts b/packages/astro/src/content/mutable-data-store.ts
index 200951848..29acf4506 100644
--- a/packages/astro/src/content/mutable-data-store.ts
+++ b/packages/astro/src/content/mutable-data-store.ts
@@ -1,7 +1,9 @@
import { promises as fs, type PathLike, existsSync } from 'node:fs';
import * as devalue from 'devalue';
+import { Traverse } from 'neotraverse/modern';
import { imageSrcToImportId, importIdToSymbolName } from '../assets/utils/resolveImports.js';
import { AstroError, AstroErrorData } from '../core/errors/index.js';
+import { IMAGE_IMPORT_PREFIX } from './consts.js';
import { type DataEntry, DataStore, type RenderedContent } from './data-store.js';
import { contentModuleToId } from './utils.js';
@@ -53,7 +55,7 @@ export class MutableDataStore extends DataStore {
this.#saveToDiskDebounced();
}
- addAssetImport(assetImport: string, filePath: string) {
+ addAssetImport(assetImport: string, filePath?: string) {
const id = imageSrcToImportId(assetImport, filePath);
if (id) {
this.#assetImports.add(id);
@@ -64,7 +66,7 @@ export class MutableDataStore extends DataStore {
}
}
- addAssetImports(assets: Array<string>, filePath: string) {
+ addAssetImports(assets: Array<string>, filePath?: string) {
assets.forEach((asset) => this.addAssetImport(asset, filePath));
}
@@ -195,7 +197,7 @@ export default new Map([\n${lines.join(',\n')}]);
entries: () => this.entries(collectionName),
values: () => this.values(collectionName),
keys: () => this.keys(collectionName),
- set: ({ id: key, data, body, filePath, deferredRender, digest, rendered }) => {
+ set: ({ id: key, data, body, filePath, deferredRender, digest, rendered, assetImports }) => {
if (!key) {
throw new Error(`ID must be a non-empty string`);
}
@@ -206,6 +208,15 @@ export default new Map([\n${lines.join(',\n')}]);
return false;
}
}
+ const foundAssets = new Set<string>(assetImports);
+ // Check for image imports in the data. These will have been prefixed during schema parsing
+ new Traverse(data).forEach((_, val) => {
+ if (typeof val === 'string' && val.startsWith(IMAGE_IMPORT_PREFIX)) {
+ const src = val.replace(IMAGE_IMPORT_PREFIX, '');
+ foundAssets.add(src);
+ }
+ });
+
const entry: DataEntry = {
id,
data,
@@ -221,6 +232,12 @@ export default new Map([\n${lines.join(',\n')}]);
}
entry.filePath = filePath;
}
+
+ if (foundAssets.size) {
+ entry.assetImports = Array.from(foundAssets);
+ this.addAssetImports(entry.assetImports, filePath);
+ }
+
if (digest) {
entry.digest = digest;
}
@@ -334,6 +351,12 @@ export interface ScopedDataStore {
* If an entry is a deferred, its rendering phase is delegated to a virtual module during the runtime phase.
*/
deferredRender?: boolean;
+ /**
+ * Assets such as images to process during the build. These should be files on disk, with a path relative to filePath.
+ * Any values that use image() in the schema will already be added automatically.
+ * @internal
+ */
+ assetImports?: Array<string>;
}) => boolean;
values: () => Array<DataEntry>;
keys: () => Array<string>;
diff --git a/packages/astro/src/core/errors/README.md b/packages/astro/src/core/errors/README.md
index f8e7350b0..65e7743a0 100644
--- a/packages/astro/src/core/errors/README.md
+++ b/packages/astro/src/core/errors/README.md
@@ -21,8 +21,8 @@ Message:
- Begin with **what happened** and **why**. (ex: `Could not use {feature} because Server-side Rendering is not enabled.`)
- Then, **describe the action the user should take**. (ex: `Update your Astro config with `output: 'server'` to enable Server-side Rendering.`)
-- Although this does not need to be as brief as the `title`, try to keep sentences short, clear and direct to give the reader all the necessary information quickly as possible.
-- Instead of writing a longer message, consider using a `hint`.
+- Although this does not need to be as brief as the `title`, try to keep sentences short, clear and direct to give the reader all the necessary information quickly as possible. Users should be able to skim the message and understand the problem and solution.
+- If your message is too long, or the solution is not guaranteed to work, use the `hint` property to provide more information.
Hint:
@@ -44,10 +44,10 @@ If you are unsure about anything, ask [Erika](https://github.com/Princesseuh)!
### Shape
-- **Names are permanent**, and should never be changed, nor deleted. Users should always be able to find an error by searching, and this ensures a matching result. When an error is no longer relevant, it should be deprecated, not removed.
+- **Names are permanent**, and should never be changed. Users should always be able to find an error by searching, and this ensures a matching result.
- Contextual information may be used to enhance the message or the hint. However, the code that caused the error or the position of the error should not be included in the message as they will already be shown as part of the error.
- Do not prefix `title`, `message` and `hint` with descriptive words such as "Error:" or "Hint:" as it may lead to duplicated labels in the UI / CLI.
-- Dynamic error messages must use the following shape:
+- Dynamic error messages **must** use the following shape:
```js
message: (arguments) => `text ${substitute}`;
@@ -69,8 +69,9 @@ Here's how to create and format the comments:
/**
* @docs <- Needed for the comment to be used for docs
* @message <- (Optional) Clearer error message to show in cases where the original one is too complex (ex: because of conditional messages)
- * @see <- List of additional references users can look at
+ * @see <- (Optional) List of additional references users can look at
* @description <- Description of the error
+ * @deprecated <- (Optional) If the error is no longer relevant, when it was removed and why (see "Removing errors" section below)
*/
```
@@ -89,6 +90,19 @@ Example:
The `@message` property is intended to provide slightly more context when it is helpful: a more descriptive error message or a collection of common messages if there are multiple possible error messages. Try to avoid making substantial changes to existing messages so that they are easy to find for users who copy and search the exact content of an error message.
+### Removing errors
+
+If the error cannot be triggered at all anymore, it can deprecated by adding a `@deprecated` tag to the JSDoc comment with a message that will be shown in the docs. This message is useful for users on previous versions who might still encounter the error so that they can know that upgrading to a newer version of Astro would perhaps solve their issue.
+
+```js
+/**
+ * @docs
+ * @deprecated Removed in Astro v9.8.6 as it is no longer relevant due to...
+ */
+```
+
+Alternatively, if no special deprecation message is needed, errors can be directly removed from the `errors-data.ts` file. A basic message will be shown in the docs stating that the error can no longer appear in the latest version of Astro.
+
### Always remember
Error are a reactive strategy. They are the last line of defense against a mistake.
@@ -99,5 +113,7 @@ While adding a new error message, ask yourself, "Was there a way this situation
## Additional resources on writing good error messages
+- [Compiler errors for humans](https://elm-lang.org/news/compiler-errors-for-humans)
- [When life gives you lemons, write better error messages](https://wix-ux.com/when-life-gives-you-lemons-write-better-error-messages-46c5223e1a2f)
-- [RustConf 2020 - Bending the Curve: A Personal Tutor at Your Fingertips by Esteban Kuber](https://www.youtube.com/watch?v=Z6X7Ada0ugE) (part on error messages starts around 19:17)
+- [RustConf 2020 - Bending the Curve: A Personal Tutor at Your Fingertips by Esteban Kuber](https://www.youtube.com/watch?v=Z6X7Ada0ugE)
+- [What's in a good error](https://erika.florist/articles/gooderrors) (by the person who wrote this document!)
diff --git a/packages/astro/src/core/errors/errors-data.ts b/packages/astro/src/core/errors/errors-data.ts
index 88cb7f6e5..72d5739f5 100644
--- a/packages/astro/src/core/errors/errors-data.ts
+++ b/packages/astro/src/core/errors/errors-data.ts
@@ -33,25 +33,7 @@ export const UnknownCompilerError = {
title: 'Unknown compiler error.',
hint: 'This is almost always a problem with the Astro compiler, not your code. Please open an issue at https://astro.build/issues/compiler.',
} satisfies ErrorData;
-// 1xxx and 2xxx codes are reserved for compiler errors and warnings respectively
-/**
- * @docs
- * @see
- * - [Enabling SSR in Your Project](https://docs.astro.build/en/guides/server-side-rendering/)
- * - [Astro.redirect](https://docs.astro.build/en/reference/api-reference/#astroredirect)
- * @description
- * The `Astro.redirect` function is only available when [Server-side rendering](/en/guides/server-side-rendering/) is enabled.
- *
- * To redirect on a static website, the [meta refresh attribute](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/meta) can be used. Certain hosts also provide config-based redirects (ex: [Netlify redirects](https://docs.netlify.com/routing/redirects/)).
- * @deprecated Deprecated since version 2.6.
- */
-export const StaticRedirectNotAvailable = {
- name: 'StaticRedirectNotAvailable',
- title: '`Astro.redirect` is not available in static mode.',
- message:
- "Redirects are only available when using `output: 'server'` or `output: 'hybrid'`. Update your Astro config if you need SSR features.",
- hint: 'See https://docs.astro.build/en/guides/server-side-rendering/ for more information on how to enable SSR.',
-} satisfies ErrorData;
+
/**
* @docs
* @see
@@ -304,21 +286,6 @@ export const InvalidGetStaticPathsReturn = {
/**
* @docs
- * @deprecated Deprecated since Astro 4.0. The RSS helper no longer exists with an error fallback.
- * @see
- * - [RSS Guide](https://docs.astro.build/en/guides/rss/)
- * @description
- * `getStaticPaths` no longer expose an helper for generating a RSS feed. We recommend migrating to the [@astrojs/rss](https://docs.astro.build/en/guides/rss/#setting-up-astrojsrss)integration instead.
- */
-export const GetStaticPathsRemovedRSSHelper = {
- name: 'GetStaticPathsRemovedRSSHelper',
- title: 'getStaticPaths RSS helper is not available anymore.',
- message:
- 'The RSS helper has been removed from `getStaticPaths`. Try the new @astrojs/rss package instead.',
- hint: 'See https://docs.astro.build/en/guides/rss/ for more information.',
-} satisfies ErrorData;
-/**
- * @docs
* @see
* - [`getStaticPaths()`](https://docs.astro.build/en/reference/api-reference/#getstaticpaths)
* - [`params`](https://docs.astro.build/en/reference/api-reference/#params)
@@ -734,28 +701,6 @@ export const NoImageMetadata = {
/**
* @docs
- * @deprecated This error is no longer Markdown specific and as such, as been replaced by `ImageNotFound`
- * @message
- * Could not find requested image `IMAGE_PATH` at `FULL_IMAGE_PATH`.
- * @see
- * - [Images](https://docs.astro.build/en/guides/images/)
- * @description
- * Astro could not find an image you included in your Markdown content. Usually, this is simply caused by a typo in the path.
- *
- * Images in Markdown are relative to the current file. To refer to an image that is located in the same folder as the `.md` file, the path should start with `./`
- */
-export const MarkdownImageNotFound = {
- name: 'MarkdownImageNotFound',
- title: 'Image not found.',
- message: (imagePath: string, fullImagePath: string | undefined) =>
- `Could not find requested image \`${imagePath}\`${
- fullImagePath ? ` at \`${fullImagePath}\`.` : '.'
- }`,
- hint: 'This is often caused by a typo in the image path. Please make sure the file exists, and is spelled correctly.',
-} satisfies ErrorData;
-
-/**
- * @docs
* @see
* - [Images](https://docs.astro.build/en/guides/images/)
* @description
@@ -1141,22 +1086,6 @@ export const MissingMiddlewareForInternationalization = {
} satisfies ErrorData;
/**
- * @deprecated
- * @docs
- * @description
- * The user tried to rewrite using a route that doesn't exist, or it emitted a runtime error during its rendering phase.
- */
-export const RewriteEncounteredAnError = {
- name: 'RewriteEncounteredAnError',
- title:
- "Astro couldn't find the route to rewrite, or if was found but it emitted an error during the rendering phase.",
- message: (route: string, stack?: string) =>
- `The route ${route} that you tried to render doesn't exist, or it emitted an error during the rendering phase. ${
- stack ? stack : ''
- }.`,
-} satisfies ErrorData;
-
-/**
* @docs
* @description
* Astro could not find an associated file with content while trying to render the route. This is an Astro error and not a user error. If restarting the dev server does not fix the problem, please file an issue.
@@ -1555,20 +1484,6 @@ export const ContentSchemaContainsSlugError = {
/**
* @docs
- * @message A collection queried via `getCollection()` does not exist.
- * @deprecated Collections that do not exist no longer result in an error. A warning is given instead.
- * @description
- * When querying a collection, ensure a collection directory with the requested name exists under `src/content/`.
- */
-export const CollectionDoesNotExistError = {
- name: 'CollectionDoesNotExistError',
- title: 'Collection does not exist',
- message: (collectionName: string) =>
- `The collection **${collectionName}** does not exist. Ensure a collection directory with this name exists.`,
- hint: 'See https://docs.astro.build/en/guides/content-collections/ for more on creating collections.',
-} satisfies ErrorData;
-/**
- * @docs
* @see
* - [Defining content collections](https://docs.astro.build/en/guides/content-collections/#defining-collections)
* @description
diff --git a/packages/astro/src/types/public/config.ts b/packages/astro/src/types/public/config.ts
index 9166ddcbe..f6fe850a9 100644
--- a/packages/astro/src/types/public/config.ts
+++ b/packages/astro/src/types/public/config.ts
@@ -1313,7 +1313,7 @@ export interface AstroUserConfig {
*
* When `i18n.routing.fallback: "rewrite"` is configured, Astro will create pages that render the contents of the fallback page on the original, requested URL.
*
- * With the following configuration, if you have the file `src/pages/en/about.astro` but not `src/pages/fr/about.astro`, the `astro build` command will generate `dist/fr/about.html` with the same content as the `dist/en/index.html` page.
+ * With the following configuration, if you have the file `src/pages/en/about.astro` but not `src/pages/fr/about.astro`, the `astro build` command will generate `dist/fr/about.html` with the same content as the `dist/en/about.html` page.
* Your site visitor will see the English version of the page at `https://example.com/fr/about/` and will not be redirected.
*
* ```js
@@ -1333,7 +1333,7 @@ export interface AstroUserConfig {
* })
* ```
*/
- fallbackType: 'redirect' | 'rewrite';
+ fallbackType?: 'redirect' | 'rewrite';
/**
* @name i18n.routing.strategy
diff --git a/packages/astro/test/content-layer.test.js b/packages/astro/test/content-layer.test.js
index d8d6a3b45..0590e7e59 100644
--- a/packages/astro/test/content-layer.test.js
+++ b/packages/astro/test/content-layer.test.js
@@ -162,17 +162,21 @@ describe('Content Layer', () => {
it('updates the store on new builds', async () => {
assert.equal(json.increment.data.lastValue, 1);
+ assert.equal(json.entryWithReference.data.something?.content, 'transform me');
await fixture.build();
const newJson = devalue.parse(await fixture.readFile('/collections.json'));
assert.equal(newJson.increment.data.lastValue, 2);
+ assert.equal(newJson.entryWithReference.data.something?.content, 'transform me');
});
it('clears the store on new build with force flag', async () => {
let newJson = devalue.parse(await fixture.readFile('/collections.json'));
assert.equal(newJson.increment.data.lastValue, 2);
+ assert.equal(newJson.entryWithReference.data.something?.content, 'transform me');
await fixture.build({ force: true }, {});
newJson = devalue.parse(await fixture.readFile('/collections.json'));
assert.equal(newJson.increment.data.lastValue, 1);
+ assert.equal(newJson.entryWithReference.data.something?.content, 'transform me');
});
it('clears the store on new build if the config has changed', async () => {
diff --git a/packages/astro/test/fixtures/client-address-node/package.json b/packages/astro/test/fixtures/client-address-node/package.json
index 4b1c6a5ee..4db07f130 100644
--- a/packages/astro/test/fixtures/client-address-node/package.json
+++ b/packages/astro/test/fixtures/client-address-node/package.json
@@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"dependencies": {
- "@astrojs/node": "workspace:*",
+ "@astrojs/node": "^8.3.3",
"astro": "workspace:*"
}
}
diff --git a/packages/astro/test/fixtures/content-layer/content-outside-src/columbia-copy.md b/packages/astro/test/fixtures/content-layer/content-outside-src/columbia-copy.md
index e5ca2b3a5..fba81378e 100644
--- a/packages/astro/test/fixtures/content-layer/content-outside-src/columbia-copy.md
+++ b/packages/astro/test/fixtures/content-layer/content-outside-src/columbia-copy.md
@@ -5,6 +5,7 @@ publishedDate: 'Sat May 21 2022 00:00:00 GMT-0400 (Eastern Daylight Time)'
tags: [space, 90s]
cat: tabby
heroImage: "./shuttle.jpg"
+something: "transform me"
---
**Source:** [Wikipedia](https://en.wikipedia.org/wiki/Space_Shuttle_Endeavour)
diff --git a/packages/astro/test/fixtures/content-layer/src/content/config.ts b/packages/astro/test/fixtures/content-layer/src/content/config.ts
index 5e25d83b9..8f06b4362 100644
--- a/packages/astro/test/fixtures/content-layer/src/content/config.ts
+++ b/packages/astro/test/fixtures/content-layer/src/content/config.ts
@@ -78,6 +78,7 @@ const spacecraft = defineCollection({
tags: z.array(z.string()),
heroImage: image().optional(),
cat: reference('cats').optional(),
+ something: z.string().optional().transform(str => ({ type: 'test', content: str }))
}),
});
@@ -120,9 +121,9 @@ const increment = defineCollection({
schema: async () => z.object({
lastValue: z.number(),
lastUpdated: z.date(),
+
}),
},
-
});
export const collections = { blog, dogs, cats, numbers, spacecraft, increment, images };
diff --git a/packages/astro/test/fixtures/content-layer/src/pages/collections.json.js b/packages/astro/test/fixtures/content-layer/src/pages/collections.json.js
index 7db3156ca..87c8cc052 100644
--- a/packages/astro/test/fixtures/content-layer/src/pages/collections.json.js
+++ b/packages/astro/test/fixtures/content-layer/src/pages/collections.json.js
@@ -17,7 +17,6 @@ export async function GET() {
const increment = await getEntry('increment', 'value');
const images = await getCollection('images');
-
return new Response(
devalue.stringify({
customLoader,
diff --git a/packages/astro/test/fixtures/custom-assets-name/package.json b/packages/astro/test/fixtures/custom-assets-name/package.json
index 00237fbdd..3530f9f0a 100644
--- a/packages/astro/test/fixtures/custom-assets-name/package.json
+++ b/packages/astro/test/fixtures/custom-assets-name/package.json
@@ -4,6 +4,6 @@
"private": true,
"dependencies": {
"astro": "workspace:*",
- "@astrojs/node": "workspace:*"
+ "@astrojs/node": "^8.3.3"
}
}
diff --git a/packages/astro/test/fixtures/postcss/package.json b/packages/astro/test/fixtures/postcss/package.json
index fad256924..45438302b 100644
--- a/packages/astro/test/fixtures/postcss/package.json
+++ b/packages/astro/test/fixtures/postcss/package.json
@@ -8,7 +8,7 @@
"@astrojs/vue": "workspace:*",
"astro": "workspace:*",
"autoprefixer": "^10.4.20",
- "postcss": "^8.4.41",
+ "postcss": "^8.4.43",
"solid-js": "^1.8.22",
"svelte": "^4.2.19",
"vue": "^3.4.38"
diff --git a/packages/astro/test/fixtures/ssr-api-route/package.json b/packages/astro/test/fixtures/ssr-api-route/package.json
index ab761dd6b..7af4e57b0 100644
--- a/packages/astro/test/fixtures/ssr-api-route/package.json
+++ b/packages/astro/test/fixtures/ssr-api-route/package.json
@@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"dependencies": {
- "@astrojs/node": "workspace:*",
+ "@astrojs/node": "^8.3.3",
"astro": "workspace:*"
}
}
diff --git a/packages/astro/test/fixtures/ssr-prerender-chunks/package.json b/packages/astro/test/fixtures/ssr-prerender-chunks/package.json
index c386358b8..503388b25 100644
--- a/packages/astro/test/fixtures/ssr-prerender-chunks/package.json
+++ b/packages/astro/test/fixtures/ssr-prerender-chunks/package.json
@@ -5,7 +5,7 @@
"dependencies": {
"@astrojs/react": "workspace:*",
"@test/ssr-prerender-chunks-test-adapter": "link:./deps/test-adapter",
- "@types/react": "^18.3.4",
+ "@types/react": "^18.3.5",
"@types/react-dom": "^18.3.0",
"astro": "workspace:*",
"react": "^18.3.1",
diff --git a/packages/astro/test/fixtures/static-build-ssr/package.json b/packages/astro/test/fixtures/static-build-ssr/package.json
index 6c8f1e499..9c39f2b2f 100644
--- a/packages/astro/test/fixtures/static-build-ssr/package.json
+++ b/packages/astro/test/fixtures/static-build-ssr/package.json
@@ -3,7 +3,7 @@
"version": "0.0.0",
"private": true,
"dependencies": {
- "@astrojs/node": "workspace:*",
+ "@astrojs/node": "^8.3.3",
"@test/static-build-pkg": "workspace:*",
"astro": "workspace:*"
}
diff --git a/packages/astro/test/fixtures/tailwindcss-ts/package.json b/packages/astro/test/fixtures/tailwindcss-ts/package.json
index a609e7b90..f20ea92e9 100644
--- a/packages/astro/test/fixtures/tailwindcss-ts/package.json
+++ b/packages/astro/test/fixtures/tailwindcss-ts/package.json
@@ -5,7 +5,7 @@
"dependencies": {
"@astrojs/tailwind": "workspace:*",
"astro": "workspace:*",
- "postcss": "^8.4.41",
+ "postcss": "^8.4.43",
"tailwindcss": "^3.4.10"
}
}
diff --git a/packages/astro/test/fixtures/tailwindcss/package.json b/packages/astro/test/fixtures/tailwindcss/package.json
index 499735686..6e175dff1 100644
--- a/packages/astro/test/fixtures/tailwindcss/package.json
+++ b/packages/astro/test/fixtures/tailwindcss/package.json
@@ -7,7 +7,7 @@
"@astrojs/tailwind": "workspace:*",
"astro": "workspace:*",
"autoprefixer": "^10.4.20",
- "postcss": "^8.4.41",
+ "postcss": "^8.4.43",
"tailwindcss": "^3.4.10"
}
}