@jill64/adapter-cloudflare
Advanced tools
Comparing version 0.1.1 to 1.0.0
{ | ||
"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. |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
13542
1
68