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:

```ts title="astro.config.mjs" del={5}
import cloudflare from '@astrojs/cloudflare';

export default defineConfig({
adapter: cloudflare({
cloudflareModules: true
})
});
```


### 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
33 changes: 33 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,38 @@ const metadata = await emitImageMetadata(imageId);
// }
```


### `emitClientAsset()`

<p>

**Type:** <code>(pluginContext: <a href="https://rollupjs.org/plugin-development/#plugin-context">Rollup.PluginContext</a>, options: Rollup.EmitFile) => string</code><br />

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

Emits a client asset that will be moved to the client directory for assets (e.g. `dist/client/_astro/`) 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.

Use this instead of [Rollup `pluginContext.emitFile()`](https://rollupjs.org/plugin-development/#this-emitfile) directly when working in a Vite plugin context and you need the emitted asset to be moved to the client output directory.

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

function myVitePlugin() {
return {
name: 'my-plugin',
transform(code, id) {
const handle = emitClientAsset(this, {
type: 'asset',
name: 'my-image.png',
source: imageBuffer,
});
// Returns the asset handle similar to `emitFile()`
}
}
}
```

### `getOrigQueryParams()`

<p>
Expand Down