summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Jonathan Dunlap <595843+jadbox@users.noreply.github.com> 2023-10-09 13:13:46 -0400
committerGravatar GitHub <noreply@github.com> 2023-10-09 19:13:46 +0200
commit054c5c6447d79dd4ea7ab6ce0f9ec836abebd211 (patch)
tree52136c33ca7d68715b98aaefc07fac61b924d01c
parent7ea27f6319da6db7b3de8e22a11a80d0ac45872f (diff)
downloadastro-054c5c6447d79dd4ea7ab6ce0f9ec836abebd211.tar.gz
astro-054c5c6447d79dd4ea7ab6ce0f9ec836abebd211.tar.zst
astro-054c5c6447d79dd4ea7ab6ce0f9ec836abebd211.zip
fix(cloudflare): support for 'cloudflare:*' imports (#8766)
* chore: add 'cloudflare:sockets' to external list * chore: add Changeset * patch: wildcard cloudflare packages * chore: updated Readme for cloudflare module support * Update .changeset/heavy-elephants-tan.md Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * Update packages/integrations/cloudflare/README.md Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> --------- Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> Co-authored-by: Alexander Niebuhr <alexander@nbhr.io>
Diffstat (limited to '')
-rw-r--r--.changeset/heavy-elephants-tan.md5
-rw-r--r--packages/integrations/cloudflare/README.md4
-rw-r--r--packages/integrations/cloudflare/src/index.ts2
3 files changed, 11 insertions, 0 deletions
diff --git a/.changeset/heavy-elephants-tan.md b/.changeset/heavy-elephants-tan.md
new file mode 100644
index 000000000..4dc2b8579
--- /dev/null
+++ b/.changeset/heavy-elephants-tan.md
@@ -0,0 +1,5 @@
+---
+'@astrojs/cloudflare': patch
+---
+
+Adds `cloudflare:sockets` compile support
diff --git a/packages/integrations/cloudflare/README.md b/packages/integrations/cloudflare/README.md
index 10a381a7b..a72e2f1d4 100644
--- a/packages/integrations/cloudflare/README.md
+++ b/packages/integrations/cloudflare/README.md
@@ -357,6 +357,10 @@ import { Buffer } from 'node:buffer';
Additionally, you'll need to enable the Compatibility Flag in Cloudflare. The configuration for this flag may vary based on where you deploy your Astro site. For detailed guidance, please refer to the [Cloudflare documentation on enabling Node.js compatibility](https://developers.cloudflare.com/workers/runtime-apis/nodejs).
+## Cloudflare module support
+
+All Cloudflare namespaced packages (e.g. `cloudflare:sockets`) are allowlisted for use. Note that the package `cloudflare:sockets` does not work locally without using Wrangler dev mode.
+
## Preview with Wrangler
To use [`wrangler`](https://developers.cloudflare.com/workers/wrangler/) to run your application locally, update the preview script:
diff --git a/packages/integrations/cloudflare/src/index.ts b/packages/integrations/cloudflare/src/index.ts
index 59cd92ce3..c0da2dd74 100644
--- a/packages/integrations/cloudflare/src/index.ts
+++ b/packages/integrations/cloudflare/src/index.ts
@@ -290,6 +290,7 @@ export default function createIntegration(args?: Options): AstroIntegration {
'node:stream',
'node:string_decoder',
'node:util',
+ 'cloudflare:*'
],
entryPoints: pathsGroup,
outbase: absolutePagesDirname,
@@ -371,6 +372,7 @@ export default function createIntegration(args?: Options): AstroIntegration {
'node:stream',
'node:string_decoder',
'node:util',
+ 'cloudflare:*'
],
entryPoints: [entryPath],
outfile: buildPath,