Socket
Socket
Sign inDemoInstall

@jill64/adapter-cloudflare

Package Overview
Dependencies
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@jill64/adapter-cloudflare - npm Package Compare versions

Comparing version 0.1.1 to 1.0.0

10

package.json
{
"name": "@jill64/adapter-cloudflare",
"version": "0.1.1",
"description": "🔌 SvelteKit Adapter for Cloudflare Pages with node_compat",
"version": "1.0.0",
"description": "🔌 SvelteKit Adapter for Cloudflare Pages with nodejs_compat",
"type": "module",

@@ -12,7 +12,3 @@ "main": "dist/index.js",

"files": [
"dist",
"!**/*.test.*",
"!**/*.spec.*",
"!*.test.*",
"!*.spec.*"
"dist"
],

@@ -19,0 +15,0 @@ "exports": {

@@ -7,14 +7,19 @@ <!----- BEGIN GHOST DOCS HEADER ----->

🔌 SvelteKit Adapter for Cloudflare Pages with node_compat
🔌 SvelteKit Adapter for Cloudflare Pages with nodejs_compat
<!----- END GHOST DOCS HEADER ----->
This adapter is based on [Node.js compatibility](https://developers.cloudflare.com/workers/runtime-apis/nodejs/) and allows some node modules to be used with Cloudflare Pages.
## Installation
```sh
npm i @jill64/adapter-cloudflare
npm i -D @jill64/adapter-cloudflare
```
<!----- END GHOST DOCS HEADER ----->
## Usage
1. Add the adapter to your project.
Adapter options are compatible with [@sveltejs/adapter-cloudflare](https://github.com/sveltejs/kit/blob/master/packages/adapter-cloudflare/index.d.ts).
```js

@@ -27,6 +32,20 @@ // svelte.config.js

adapter: adapter({
// /* @sveltejs/adapter-cloudflare options */
/* @sveltejs/adapter-cloudflare options */
// routes: {
// // ...
// },
// }
})
}
}
```
If you need a node module that is not officially supported, add a polyfill with the following options based on [esbuild-plugin-polyfill-node](https://github.com/cyco130/esbuild-plugin-polyfill-node#esbuild-plugin-polyfill-node).
```js
// svelte.config.js
import adapter from '@jill64/adapter-cloudflare'
export default {
kit: {
adapter: adapter({
// /* esbuild-plugin-polyfill-node options */

@@ -43,1 +62,9 @@ // globals: {

```
2. Enable Node.js compatibility in Cloudflare Pages.
1. Go to Pages project page.
2. Click the "Settings" => "Functions".
3. Add `nodejs_compat` to the Compatibility flags.
3. Deploy your project.
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc