Skip to content
17 changes: 17 additions & 0 deletions src/content/docs/en/guides/integrations-guide/cloudflare.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -591,6 +591,23 @@ If you were using a custom `workerEntryPoint` configuration in the adapter optio

The manifest is now created internally by the adapter, so it does not need to be passed to your handler.

### Removed: `cloudflareModules` option

The `cloudflareModules` adapter option has been removed because it is no longer necessary. Cloudflare natively supports importing `.sql`, `.wasm`, and other module types.

Remove the `cloudflareModules` option from your Cloudflare adapter configuration if you were using it:

```diff
Comment thread
matthewp marked this conversation as resolved.
Resolved
import cloudflare from '@astrojs/cloudflare';

export default defineConfig({
adapter: cloudflare({
- cloudflareModules: true
Comment thread
matthewp marked this conversation as resolved.
Resolved
})
});
```


### New: `astro preview` support

Use `astro preview` to test your Cloudflare Workers application locally before deploying. The preview runs using Cloudflare's `workerd` runtime, closely mirroring production behavior. Run `astro build` followed by `astro preview` to start the preview server.
Expand Down
27 changes: 27 additions & 0 deletions src/content/docs/en/reference/modules/astro-assets.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -846,6 +846,7 @@ import {
resolveSrc,
imageMetadata,
emitImageMetadata,
emitClientAsset,
getOrigQueryParams,
inferRemoteSize,
propsToFilename,
Expand Down Expand Up @@ -1111,6 +1112,32 @@ const metadata = await emitImageMetadata(imageId);
// }
```


### `emitClientAsset()`

<p>

**Type:** `(pluginContext: Rollup.PluginContext, options: Rollup.EmitFile) => string`<br />
Comment thread
matthewp marked this conversation as resolved.
Resolved

<Since v="6.0.0" />
</p>

Emits a client asset and tracks it for later movement to the client directory during SSR builds. This function is intended for integration authors who need to emit assets (such as images) from server-rendered content that should be available on the client.
Comment thread
matthewp marked this conversation as resolved.
Resolved

Use this instead of `pluginContext.emitFile()` directly when working in a Vite plugin context and you need the emitted asset to be moved to the client output directory.
Comment thread
matthewp marked this conversation as resolved.
Resolved

```ts
import { emitClientAsset } from 'astro/assets/utils';

// Inside a Vite plugin's transform or load hook
const handle = emitClientAsset(this, {
Comment thread
matthewp marked this conversation as resolved.
Resolved
type: 'asset',
name: 'my-image.png',
source: imageBuffer,
});
// Returns the asset handle (e.g., "a]b2c3d4")
Comment thread
matthewp marked this conversation as resolved.
Resolved
```

### `getOrigQueryParams()`

<p>
Expand Down