Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@sveltejs/adapter-cloudflare-workers

Package Overview
Dependencies
Maintainers
4
Versions
101
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@sveltejs/adapter-cloudflare-workers - npm Package Compare versions

Comparing version 1.0.0-next.23 to 1.0.0-next.24

6

package.json
{
"name": "@sveltejs/adapter-cloudflare-workers",
"version": "1.0.0-next.23",
"version": "1.0.0-next.24",
"repository": {

@@ -25,6 +25,6 @@ "type": "git",

"@iarna/toml": "^2.2.5",
"esbuild": "^0.13.3"
"esbuild": "^0.13.4"
},
"devDependencies": {
"@sveltejs/kit": "1.0.0-next.177"
"@sveltejs/kit": "1.0.0-next.181"
},

@@ -31,0 +31,0 @@ "scripts": {

@@ -9,2 +9,4 @@ # adapter-cloudflare-workers

**You will need [Wrangler](https://developers.cloudflare.com/workers/cli-wrangler/install-update) installed on your system**
This adapter expects to find a [wrangler.toml](https://developers.cloudflare.com/workers/platform/sites/configuration) file in the project root. It will determine where to write static assets and the worker based on the `site.bucket` and `site.entry-point` settings.

@@ -15,11 +17,30 @@

```sh
$ wrangler init --site my-site-name
wrangler init --site my-site-name
```
Then configure your sites build directory in the config file:
Add the adapter to your `svelte.config.js`:
```js
import adapter from '@sveltejs/adapter-cloudflare-workers';
export default {
kit: {
target: '#svelte',
adapter: adapter()
}
};
```
Now you should get some details from Cloudflare. You should get your:
1. Account ID
2. And your Zone-ID (Optional)
Get them by visiting your Cloudflare-Dashboard and click on any domain. There, you can scroll down and on the left, you can see your details under **API**.
Then configure your sites build directory and your account-details in the config file:
```toml
[site]
bucket = "./build"
entry-point = "./workers-site"
account_id = 'YOUR ACCOUNT_ID'
zone_id = 'YOUR ZONE_ID' # optional, if you don't specify this a workers.dev subdomain will be used.
site = {bucket = "./build", entry-point = "./workers-site"}
```

@@ -29,2 +50,16 @@

Now, log in with wrangler:
```sh
wrangler login
```
Build your project and publish it:
```sh
npm run build && wrangler publish
```
**You are done!**
More info on configuring a cloudflare worker site can be found [here](https://developers.cloudflare.com/workers/platform/sites/start-from-existing)

@@ -42,5 +77,5 @@

adapterCfw({
esbuild(defaultOptions) {
esbuild(options) {
return {
...defaultOptions,
...options,
plugins: []

@@ -55,9 +90,9 @@ };

```js
{
entryPoints: ['.svelte-kit/cloudflare-workers/entry.js'],
outfile: `${entrypoint}/index.js`,
bundle: true,
target: 'es2020',
platform: 'browser'
}
const options = {
entryPoints: ['.svelte-kit/cloudflare-workers/entry.js'],
outfile: `${entrypoint}/index.js`,
bundle: true,
target: 'es2020',
platform: 'browser'
};
```

@@ -64,0 +99,0 @@

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