Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use astro: namespace modules #4239

Merged
merged 3 commits into from
Aug 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/content/docs/en/guides/middleware.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ You can import and use the utility function `defineMiddleware()` to take advanta

```ts
// src/middleware.ts
import { defineMiddleware } from "astro/middleware";
import { defineMiddleware } from "astro:middleware";

// `context` and `next` are automatically typed
export const onRequest = defineMiddleware((context, next) => {
Expand Down Expand Up @@ -137,7 +137,7 @@ export const onRequest = async (context, next) => {
Multiple middlewares can be joined in a specified order using [`sequence()`](#sequence):

```js title="src/middleware.js"
import { sequence } from "astro/middleware";
import { sequence } from "astro:middleware";

async function validation(_, next) {
console.log("validation request");
Expand Down Expand Up @@ -218,4 +218,4 @@ This function can be used by integrations/adapters to programmatically execute t

### `trySerializeLocals`

A low-level API that takes in any value and tries to return a serialized version (a string) of it. If the value cannot be serialized, the function will throw a runtime error.
A low-level API that takes in any value and tries to return a serialized version (a string) of it. If the value cannot be serialized, the function will throw a runtime error.
4 changes: 2 additions & 2 deletions src/content/docs/en/guides/troubleshooting.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ To help you debug your Astro components, Astro provides a built-in [`<Debug />`]

```astro {2,7}
---
import { Debug } from 'astro/components';
import { Debug } from 'astro:components';
const sum = (a, b) => a + b;
---

Expand All @@ -210,7 +210,7 @@ The Debug component supports a variety of syntax options for even more flexible

```astro {2,7-9}
---
import { Debug } from 'astro/components';
import { Debug } from 'astro:components';
const sum = (a, b) => a + b;
const answer = sum(2, 4);
---
Expand Down
6 changes: 3 additions & 3 deletions src/content/docs/en/reference/api-reference.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -1044,13 +1044,13 @@ export default function () {

## Built-in Components

Astro includes several built-in components for you to use in your projects. All built-in components are available in `.astro` files via `import {} from 'astro/components';`.
Astro includes several built-in components for you to use in your projects. All built-in components are available in `.astro` files via `import {} from 'astro:components';`.

### `<Code />`

```astro 'theme="dark-plus"' /wrap\b/ /(inline) \/>/
---
import { Code } from 'astro/components';
import { Code } from 'astro:components';
---
<!-- Syntax highlight some JavaScript code. -->
<Code code={`const foo = 'bar';`} lang="js" />
Expand Down Expand Up @@ -1112,7 +1112,7 @@ See the [list of languages supported by Prism](https://prismjs.com/#supported-la

```astro
---
import { Debug } from 'astro/components';
import { Debug } from 'astro:components';
const serverObject = {
a: 0,
b: "string",
Expand Down