From 18b3c3db91e05d7b1aec93a8f24e329788a7126f Mon Sep 17 00:00:00 2001 From: Quang Phan Date: Thu, 21 Mar 2024 20:50:19 +0700 Subject: [PATCH 01/16] feat: allow passing config to getPlatformProxy via platformProxy option --- .changeset/tough-dolphins-kick.md | 6 ++++++ .../docs/25-build-and-deploy/60-adapter-cloudflare.md | 2 ++ .../25-build-and-deploy/70-adapter-cloudflare-workers.md | 2 ++ packages/adapter-cloudflare-workers/index.d.ts | 6 ++++++ packages/adapter-cloudflare-workers/index.js | 4 ++-- packages/adapter-cloudflare/index.d.ts | 7 +++++++ packages/adapter-cloudflare/index.js | 2 +- 7 files changed, 26 insertions(+), 3 deletions(-) create mode 100644 .changeset/tough-dolphins-kick.md diff --git a/.changeset/tough-dolphins-kick.md b/.changeset/tough-dolphins-kick.md new file mode 100644 index 000000000000..7f08d35ed8a0 --- /dev/null +++ b/.changeset/tough-dolphins-kick.md @@ -0,0 +1,6 @@ +--- +"@sveltejs/adapter-cloudflare-workers": minor +"@sveltejs/adapter-cloudflare": minor +--- + +feat: support platform emulation configuration via the `platformProxy` adapter option diff --git a/documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md b/documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md index d819350a1d05..990f00bcc33a 100644 --- a/documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md +++ b/documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md @@ -94,6 +94,8 @@ Cloudflare Workers specific values in the `platform` property are emulated durin For testing the build, you should use [wrangler](https://developers.cloudflare.com/workers/cli-wrangler) **version 3**. Once you have built your site, run `wrangler pages dev .svelte-kit/cloudflare`. +Under the hood, `adapter-cloudflare` uses [getPlatformProxy](https://developers.cloudflare.com/workers/wrangler/api/#getplatformproxy) from Wrangler API for `platform` emulation. Further configuration can be passed to `getPlatformProxy` via the `platformProxy` option in your adapter config. + ## Notes Functions contained in the `/functions` directory at the project's root will _not_ be included in the deployment, which is compiled to a [single `_worker.js` file](https://developers.cloudflare.com/pages/platform/functions/#advanced-mode). Functions should be implemented as [server endpoints](https://kit.svelte.dev/docs/routing#server) in your SvelteKit app. diff --git a/documentation/docs/25-build-and-deploy/70-adapter-cloudflare-workers.md b/documentation/docs/25-build-and-deploy/70-adapter-cloudflare-workers.md index eba4d9556c7d..fcbddb0e2fa9 100644 --- a/documentation/docs/25-build-and-deploy/70-adapter-cloudflare-workers.md +++ b/documentation/docs/25-build-and-deploy/70-adapter-cloudflare-workers.md @@ -121,6 +121,8 @@ Cloudflare Workers specific values in the `platform` property are emulated durin For testing the build, you should use [wrangler](https://developers.cloudflare.com/workers/cli-wrangler) **version 3**. Once you have built your site, run `wrangler dev`. +Under the hood, `adapter-cloudflare-workers` uses [getPlatformProxy](https://developers.cloudflare.com/workers/wrangler/api/#getplatformproxy) from Wrangler API for `platform` emulation. Further configuration can be passed to `getPlatformProxy` via the `platformProxy` option in your adapter config. + ## Troubleshooting ### Worker size limits diff --git a/packages/adapter-cloudflare-workers/index.d.ts b/packages/adapter-cloudflare-workers/index.d.ts index 5bfd868e0604..d25b01223d95 100644 --- a/packages/adapter-cloudflare-workers/index.d.ts +++ b/packages/adapter-cloudflare-workers/index.d.ts @@ -1,8 +1,14 @@ import { Adapter } from '@sveltejs/kit'; import './ambient.js'; +import { GetPlatformProxyOptions } from 'wrangler'; export default function plugin(options?: AdapterOptions): Adapter; export interface AdapterOptions { config?: string; + /** + * Config object passed to {@link https://developers.cloudflare.com/workers/wrangler/api/#getplatformproxy | getPlatformProxy} + * during development & preview + */ + platformProxy?: GetPlatformProxyOptions; } diff --git a/packages/adapter-cloudflare-workers/index.js b/packages/adapter-cloudflare-workers/index.js index f9237e44dbb7..40ab4bf0224b 100644 --- a/packages/adapter-cloudflare-workers/index.js +++ b/packages/adapter-cloudflare-workers/index.js @@ -32,7 +32,7 @@ const compatible_node_modules = [ ]; /** @type {import('./index.js').default} */ -export default function ({ config = 'wrangler.toml' } = {}) { +export default function ({ config = 'wrangler.toml', platformProxy = {} } = {}) { return { name: '@sveltejs/adapter-cloudflare-workers', @@ -144,7 +144,7 @@ export default function ({ config = 'wrangler.toml' } = {}) { }, async emulate() { - const proxy = await getPlatformProxy(); + const proxy = await getPlatformProxy(platformProxy); const platform = /** @type {App.Platform} */ ({ env: proxy.env, context: proxy.ctx, diff --git a/packages/adapter-cloudflare/index.d.ts b/packages/adapter-cloudflare/index.d.ts index 0ef6ee967d85..a13f8eaf7755 100644 --- a/packages/adapter-cloudflare/index.d.ts +++ b/packages/adapter-cloudflare/index.d.ts @@ -1,5 +1,6 @@ import { Adapter } from '@sveltejs/kit'; import './ambient.js'; +import { GetPlatformProxyOptions } from 'wrangler'; export default function plugin(options?: AdapterOptions): Adapter; @@ -42,6 +43,12 @@ export interface AdapterOptions { */ exclude?: string[]; }; + + /** + * Config object passed to {@link https://developers.cloudflare.com/workers/wrangler/api/#getplatformproxy | getPlatformProxy} + * during dev & preview + */ + platformProxy?: GetPlatformProxyOptions; } export interface RoutesJSONSpec { diff --git a/packages/adapter-cloudflare/index.js b/packages/adapter-cloudflare/index.js index 16adc5f88e72..a5e276538e33 100644 --- a/packages/adapter-cloudflare/index.js +++ b/packages/adapter-cloudflare/index.js @@ -127,7 +127,7 @@ export default function (options = {}) { } }, async emulate() { - const proxy = await getPlatformProxy(); + const proxy = await getPlatformProxy(options.platformProxy); const platform = /** @type {App.Platform} */ ({ env: proxy.env, context: proxy.ctx, From fbdccf01045f28930bf59ae1352f1d171c2ed64b Mon Sep 17 00:00:00 2001 From: Tee Ming Date: Mon, 8 Apr 2024 18:10:05 +0800 Subject: [PATCH 02/16] remove platformProxy default value --- packages/adapter-cloudflare-workers/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/adapter-cloudflare-workers/index.js b/packages/adapter-cloudflare-workers/index.js index 40ab4bf0224b..94f8c9d2d367 100644 --- a/packages/adapter-cloudflare-workers/index.js +++ b/packages/adapter-cloudflare-workers/index.js @@ -32,7 +32,7 @@ const compatible_node_modules = [ ]; /** @type {import('./index.js').default} */ -export default function ({ config = 'wrangler.toml', platformProxy = {} } = {}) { +export default function ({ config = 'wrangler.toml', platformProxy } = {}) { return { name: '@sveltejs/adapter-cloudflare-workers', From 63b60290a3439f29b982c928771d589a11a15109 Mon Sep 17 00:00:00 2001 From: Tee Ming Date: Mon, 8 Apr 2024 19:23:13 +0800 Subject: [PATCH 03/16] Update packages/adapter-cloudflare-workers/index.js --- packages/adapter-cloudflare-workers/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/adapter-cloudflare-workers/index.js b/packages/adapter-cloudflare-workers/index.js index 94f8c9d2d367..bd7ff1f9c21e 100644 --- a/packages/adapter-cloudflare-workers/index.js +++ b/packages/adapter-cloudflare-workers/index.js @@ -32,7 +32,7 @@ const compatible_node_modules = [ ]; /** @type {import('./index.js').default} */ -export default function ({ config = 'wrangler.toml', platformProxy } = {}) { +export default function ({ config = 'wrangler.toml', platformProxy = undefined } = {}) { return { name: '@sveltejs/adapter-cloudflare-workers', From 4aabf169b7f28c1c82716d001a08aea434a4041f Mon Sep 17 00:00:00 2001 From: Tee Ming Date: Mon, 8 Apr 2024 19:38:13 +0800 Subject: [PATCH 04/16] Update 60-adapter-cloudflare.md --- .../60-adapter-cloudflare.md | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md b/documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md index 990f00bcc33a..604797e05e7a 100644 --- a/documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md +++ b/documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md @@ -28,7 +28,10 @@ export default { routes: { include: ['/*'], exclude: [''] - } + }, + platformProxy: { + + } }) } }; @@ -36,7 +39,9 @@ export default { ## Options -The `routes` option allows you to customise the [`_routes.json`](https://developers.cloudflare.com/pages/platform/functions/routing/#create-a-_routesjson-file) file generated by `adapter-cloudflare`. +### routes + +Allows you to customise the [`_routes.json`](https://developers.cloudflare.com/pages/platform/functions/routing/#create-a-_routesjson-file) file generated by `adapter-cloudflare`. - `include` defines routes that will invoke a function, and defaults to `['/*']` - `exclude` defines routes that will _not_ invoke a function — this is a faster and cheaper way to serve your app's static assets. This array can include the following special values: @@ -47,6 +52,10 @@ The `routes` option allows you to customise the [`_routes.json`](https://develop You can have up to 100 `include` and `exclude` rules combined. Generally you can omit the `routes` options, but if (for example) your `` paths exceed that limit, you may find it helpful to manually create an `exclude` list that includes `'/articles/*'` instead of the auto-generated `['/articles/foo', '/articles/bar', '/articles/baz', ...]`. +### platformProxy + +Preferences for the emulated `platform.env` local bindings. See the [getPlatformProxy](https://developers.cloudflare.com/workers/wrangler/api/#syntax) Wrangler API documentation for a full list of options. + ## Deployment Please follow the [Get Started Guide](https://developers.cloudflare.com/pages/get-started) for Cloudflare Pages to begin. @@ -90,12 +99,10 @@ export {}; ### Testing Locally -Cloudflare Workers specific values in the `platform` property are emulated during dev and preview modes. Local [bindings](https://developers.cloudflare.com/workers/wrangler/configuration/#bindings) are created based on the configuration in your `wrangler.toml` file and are used to populate `platform.env` during development. +Cloudflare Workers specific values in the `platform` property are emulated during dev and preview modes. Local [bindings](https://developers.cloudflare.com/workers/wrangler/configuration/#bindings) are created based on the configuration in your `wrangler.toml` file and are used to populate `platform.env` during development and preview. Use the adapter config [`platformProxy` option](#platformProxy) to change your preferences for the bindings. For testing the build, you should use [wrangler](https://developers.cloudflare.com/workers/cli-wrangler) **version 3**. Once you have built your site, run `wrangler pages dev .svelte-kit/cloudflare`. -Under the hood, `adapter-cloudflare` uses [getPlatformProxy](https://developers.cloudflare.com/workers/wrangler/api/#getplatformproxy) from Wrangler API for `platform` emulation. Further configuration can be passed to `getPlatformProxy` via the `platformProxy` option in your adapter config. - ## Notes Functions contained in the `/functions` directory at the project's root will _not_ be included in the deployment, which is compiled to a [single `_worker.js` file](https://developers.cloudflare.com/pages/platform/functions/#advanced-mode). Functions should be implemented as [server endpoints](https://kit.svelte.dev/docs/routing#server) in your SvelteKit app. From e22367e4415e6c0bf3a69bc7578a04210ec9dcd6 Mon Sep 17 00:00:00 2001 From: Tee Ming Date: Mon, 8 Apr 2024 19:50:24 +0800 Subject: [PATCH 05/16] Update 60-adapter-cloudflare.md --- documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md b/documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md index 604797e05e7a..979640bf353b 100644 --- a/documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md +++ b/documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md @@ -30,7 +30,7 @@ export default { exclude: [''] }, platformProxy: { - + persist: './your-custom-path' } }) } From 3a02a480fcf3c87e332f2bf8b30535c3c2980e0f Mon Sep 17 00:00:00 2001 From: Tee Ming Date: Mon, 8 Apr 2024 19:50:27 +0800 Subject: [PATCH 06/16] Update 70-adapter-cloudflare-workers.md --- .../70-adapter-cloudflare-workers.md | 35 ++++++++++--------- 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/documentation/docs/25-build-and-deploy/70-adapter-cloudflare-workers.md b/documentation/docs/25-build-and-deploy/70-adapter-cloudflare-workers.md index fcbddb0e2fa9..f42a8a7b360b 100644 --- a/documentation/docs/25-build-and-deploy/70-adapter-cloudflare-workers.md +++ b/documentation/docs/25-build-and-deploy/70-adapter-cloudflare-workers.md @@ -17,11 +17,26 @@ import adapter from '@sveltejs/adapter-cloudflare-workers'; export default { kit: { - adapter: adapter() + adapter: adapter({ + config: '.toml', + platformProxy: { + persist: './your-custom-path' + } + }) } }; ``` +## Options + +### config + +Path to your custom `wrangler.toml` config file. + +### platformProxy + +Preferences for the emulated `platform.env` local bindings. See the [getPlatformProxy](https://developers.cloudflare.com/workers/wrangler/api/#syntax) Wrangler API documentation for a full list of options. + ## Basic Configuration This adapter expects to find a [wrangler.toml](https://developers.cloudflare.com/workers/platform/sites/configuration) file in the project root. It should look something like this: @@ -63,19 +78,7 @@ wrangler deploy ## Custom config -If you would like to use a config file other than `wrangler.toml`, you can do like so: - -```js -// @errors: 2307 -/// file: svelte.config.js -import adapter from '@sveltejs/adapter-cloudflare-workers'; - -export default { - kit: { - adapter: adapter({ config: '.toml' }) - } -}; -``` +If you would like to use a config file other than `wrangler.toml` you can specify so using the [config option](#config). If you would like to enable [Node.js compatibility](https://developers.cloudflare.com/workers/runtime-apis/nodejs/#enable-nodejs-from-the-cloudflare-dashboard), you can add "nodejs_compat" flag to `wrangler.toml`: @@ -117,12 +120,10 @@ export {}; ### Testing Locally -Cloudflare Workers specific values in the `platform` property are emulated during dev and preview modes. Local [bindings](https://developers.cloudflare.com/workers/wrangler/configuration/#bindings) are created based on the configuration in your `wrangler.toml` file and are used to populate `platform.env` during development. +Cloudflare Workers specific values in the `platform` property are emulated during dev and preview modes. Local [bindings](https://developers.cloudflare.com/workers/wrangler/configuration/#bindings) are created based on the configuration in your `wrangler.toml` file and are used to populate `platform.env` during development and preview. Use the adapter config [`platformProxy` option](#platformProxy) to change your preferences for the bindings. For testing the build, you should use [wrangler](https://developers.cloudflare.com/workers/cli-wrangler) **version 3**. Once you have built your site, run `wrangler dev`. -Under the hood, `adapter-cloudflare-workers` uses [getPlatformProxy](https://developers.cloudflare.com/workers/wrangler/api/#getplatformproxy) from Wrangler API for `platform` emulation. Further configuration can be passed to `getPlatformProxy` via the `platformProxy` option in your adapter config. - ## Troubleshooting ### Worker size limits From 70444dd136ad7d0bb2d851473ab040ec89a456b3 Mon Sep 17 00:00:00 2001 From: Tee Ming Date: Mon, 8 Apr 2024 19:51:58 +0800 Subject: [PATCH 07/16] Update index.d.ts --- packages/adapter-cloudflare/index.d.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/adapter-cloudflare/index.d.ts b/packages/adapter-cloudflare/index.d.ts index a13f8eaf7755..a1cacb498e24 100644 --- a/packages/adapter-cloudflare/index.d.ts +++ b/packages/adapter-cloudflare/index.d.ts @@ -18,7 +18,7 @@ export interface AdapterOptions { fallback?: 'plaintext' | 'spa'; /** - * Customize the automatically-generated `_routes.json` file + * Customize the automatically-generated `_routes.json` file. * https://developers.cloudflare.com/pages/platform/functions/routing/#create-a-_routesjson-file */ routes?: { @@ -46,7 +46,7 @@ export interface AdapterOptions { /** * Config object passed to {@link https://developers.cloudflare.com/workers/wrangler/api/#getplatformproxy | getPlatformProxy} - * during dev & preview + * during development and preview. */ platformProxy?: GetPlatformProxyOptions; } From 48dfb5b8eccd902dc1d2f5fb7ecb56c0347a9f3f Mon Sep 17 00:00:00 2001 From: Tee Ming Date: Mon, 8 Apr 2024 19:53:22 +0800 Subject: [PATCH 08/16] Update packages/adapter-cloudflare-workers/index.d.ts --- packages/adapter-cloudflare-workers/index.d.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/adapter-cloudflare-workers/index.d.ts b/packages/adapter-cloudflare-workers/index.d.ts index d25b01223d95..b76003735910 100644 --- a/packages/adapter-cloudflare-workers/index.d.ts +++ b/packages/adapter-cloudflare-workers/index.d.ts @@ -8,7 +8,7 @@ export interface AdapterOptions { config?: string; /** * Config object passed to {@link https://developers.cloudflare.com/workers/wrangler/api/#getplatformproxy | getPlatformProxy} - * during development & preview + * during development and preview. */ platformProxy?: GetPlatformProxyOptions; } From c3e4ef770ce8043296c423b9177c7a559299f2e3 Mon Sep 17 00:00:00 2001 From: Tee Ming Date: Mon, 8 Apr 2024 19:56:53 +0800 Subject: [PATCH 09/16] Update packages/adapter-cloudflare-workers/index.js --- packages/adapter-cloudflare-workers/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/adapter-cloudflare-workers/index.js b/packages/adapter-cloudflare-workers/index.js index bd7ff1f9c21e..40ab4bf0224b 100644 --- a/packages/adapter-cloudflare-workers/index.js +++ b/packages/adapter-cloudflare-workers/index.js @@ -32,7 +32,7 @@ const compatible_node_modules = [ ]; /** @type {import('./index.js').default} */ -export default function ({ config = 'wrangler.toml', platformProxy = undefined } = {}) { +export default function ({ config = 'wrangler.toml', platformProxy = {} } = {}) { return { name: '@sveltejs/adapter-cloudflare-workers', From dfd4fb209fe26c2652eb790363dcf913bb88e440 Mon Sep 17 00:00:00 2001 From: Tee Ming Date: Mon, 8 Apr 2024 20:05:59 +0800 Subject: [PATCH 10/16] Update documentation/docs/25-build-and-deploy/70-adapter-cloudflare-workers.md --- .../docs/25-build-and-deploy/70-adapter-cloudflare-workers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/docs/25-build-and-deploy/70-adapter-cloudflare-workers.md b/documentation/docs/25-build-and-deploy/70-adapter-cloudflare-workers.md index f42a8a7b360b..4b47867e2925 100644 --- a/documentation/docs/25-build-and-deploy/70-adapter-cloudflare-workers.md +++ b/documentation/docs/25-build-and-deploy/70-adapter-cloudflare-workers.md @@ -78,7 +78,7 @@ wrangler deploy ## Custom config -If you would like to use a config file other than `wrangler.toml` you can specify so using the [config option](#config). +If you would like to use a config file other than `wrangler.toml` you can specify so using the [`config` option](#config). If you would like to enable [Node.js compatibility](https://developers.cloudflare.com/workers/runtime-apis/nodejs/#enable-nodejs-from-the-cloudflare-dashboard), you can add "nodejs_compat" flag to `wrangler.toml`: From 280c9997e48ff018f0fbaad101a76423827533b2 Mon Sep 17 00:00:00 2001 From: Tee Ming Date: Mon, 8 Apr 2024 20:07:39 +0800 Subject: [PATCH 11/16] Update documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md --- documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md b/documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md index 979640bf353b..51a39a8f3d5e 100644 --- a/documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md +++ b/documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md @@ -99,7 +99,7 @@ export {}; ### Testing Locally -Cloudflare Workers specific values in the `platform` property are emulated during dev and preview modes. Local [bindings](https://developers.cloudflare.com/workers/wrangler/configuration/#bindings) are created based on the configuration in your `wrangler.toml` file and are used to populate `platform.env` during development and preview. Use the adapter config [`platformProxy` option](#platformProxy) to change your preferences for the bindings. +Cloudflare Workers specific values in the `platform` property are emulated during dev and preview modes. Local [bindings](https://developers.cloudflare.com/workers/wrangler/configuration/#bindings) are created based on the configuration in your `wrangler.toml` file and are used to populate `platform.env` during development and preview. Use the adapter config [`platformProxy` option](#options-platformProxy) to change your preferences for the bindings. For testing the build, you should use [wrangler](https://developers.cloudflare.com/workers/cli-wrangler) **version 3**. Once you have built your site, run `wrangler pages dev .svelte-kit/cloudflare`. From 6ad769f55d207264506a5d5a9dc20afeaecb88e8 Mon Sep 17 00:00:00 2001 From: Tee Ming Date: Mon, 8 Apr 2024 20:08:11 +0800 Subject: [PATCH 12/16] Update documentation/docs/25-build-and-deploy/70-adapter-cloudflare-workers.md --- .../docs/25-build-and-deploy/70-adapter-cloudflare-workers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/docs/25-build-and-deploy/70-adapter-cloudflare-workers.md b/documentation/docs/25-build-and-deploy/70-adapter-cloudflare-workers.md index 4b47867e2925..341cd2a87f72 100644 --- a/documentation/docs/25-build-and-deploy/70-adapter-cloudflare-workers.md +++ b/documentation/docs/25-build-and-deploy/70-adapter-cloudflare-workers.md @@ -120,7 +120,7 @@ export {}; ### Testing Locally -Cloudflare Workers specific values in the `platform` property are emulated during dev and preview modes. Local [bindings](https://developers.cloudflare.com/workers/wrangler/configuration/#bindings) are created based on the configuration in your `wrangler.toml` file and are used to populate `platform.env` during development and preview. Use the adapter config [`platformProxy` option](#platformProxy) to change your preferences for the bindings. +Cloudflare Workers specific values in the `platform` property are emulated during dev and preview modes. Local [bindings](https://developers.cloudflare.com/workers/wrangler/configuration/#bindings) are created based on the configuration in your `wrangler.toml` file and are used to populate `platform.env` during development and preview. Use the adapter config [`platformProxy` option](#options-platformProxy) to change your preferences for the bindings. For testing the build, you should use [wrangler](https://developers.cloudflare.com/workers/cli-wrangler) **version 3**. Once you have built your site, run `wrangler dev`. From 744a8e8654088f8f3e41fe70a9dd51ce1a8337cc Mon Sep 17 00:00:00 2001 From: Tee Ming Date: Mon, 8 Apr 2024 20:08:29 +0800 Subject: [PATCH 13/16] Update documentation/docs/25-build-and-deploy/70-adapter-cloudflare-workers.md --- .../docs/25-build-and-deploy/70-adapter-cloudflare-workers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/docs/25-build-and-deploy/70-adapter-cloudflare-workers.md b/documentation/docs/25-build-and-deploy/70-adapter-cloudflare-workers.md index 341cd2a87f72..1470943ba2af 100644 --- a/documentation/docs/25-build-and-deploy/70-adapter-cloudflare-workers.md +++ b/documentation/docs/25-build-and-deploy/70-adapter-cloudflare-workers.md @@ -78,7 +78,7 @@ wrangler deploy ## Custom config -If you would like to use a config file other than `wrangler.toml` you can specify so using the [`config` option](#config). +If you would like to use a config file other than `wrangler.toml` you can specify so using the [`config` option](#options-config). If you would like to enable [Node.js compatibility](https://developers.cloudflare.com/workers/runtime-apis/nodejs/#enable-nodejs-from-the-cloudflare-dashboard), you can add "nodejs_compat" flag to `wrangler.toml`: From 761e9e50ee4d47062254a795ccd7b46a745d356f Mon Sep 17 00:00:00 2001 From: Tee Ming Date: Mon, 8 Apr 2024 21:35:28 +0800 Subject: [PATCH 14/16] Update 60-adapter-cloudflare.md From 4791b937a25cdb12b531e8da9c6ec988bd295c91 Mon Sep 17 00:00:00 2001 From: Tee Ming Date: Mon, 8 Apr 2024 22:00:30 +0800 Subject: [PATCH 15/16] Update documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md --- documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md b/documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md index 51a39a8f3d5e..a41e4b422a96 100644 --- a/documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md +++ b/documentation/docs/25-build-and-deploy/60-adapter-cloudflare.md @@ -99,7 +99,7 @@ export {}; ### Testing Locally -Cloudflare Workers specific values in the `platform` property are emulated during dev and preview modes. Local [bindings](https://developers.cloudflare.com/workers/wrangler/configuration/#bindings) are created based on the configuration in your `wrangler.toml` file and are used to populate `platform.env` during development and preview. Use the adapter config [`platformProxy` option](#options-platformProxy) to change your preferences for the bindings. +Cloudflare Workers specific values in the `platform` property are emulated during dev and preview modes. Local [bindings](https://developers.cloudflare.com/workers/wrangler/configuration/#bindings) are created based on the configuration in your `wrangler.toml` file and are used to populate `platform.env` during development and preview. Use the adapter config [`platformProxy` option](#options-platformproxy) to change your preferences for the bindings. For testing the build, you should use [wrangler](https://developers.cloudflare.com/workers/cli-wrangler) **version 3**. Once you have built your site, run `wrangler pages dev .svelte-kit/cloudflare`. From deab0fd20ce5dff8d01902584c2c08cf9ae68f98 Mon Sep 17 00:00:00 2001 From: Tee Ming Date: Mon, 8 Apr 2024 22:00:50 +0800 Subject: [PATCH 16/16] Update documentation/docs/25-build-and-deploy/70-adapter-cloudflare-workers.md --- .../docs/25-build-and-deploy/70-adapter-cloudflare-workers.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/documentation/docs/25-build-and-deploy/70-adapter-cloudflare-workers.md b/documentation/docs/25-build-and-deploy/70-adapter-cloudflare-workers.md index 1470943ba2af..0d1c29f3c947 100644 --- a/documentation/docs/25-build-and-deploy/70-adapter-cloudflare-workers.md +++ b/documentation/docs/25-build-and-deploy/70-adapter-cloudflare-workers.md @@ -120,7 +120,7 @@ export {}; ### Testing Locally -Cloudflare Workers specific values in the `platform` property are emulated during dev and preview modes. Local [bindings](https://developers.cloudflare.com/workers/wrangler/configuration/#bindings) are created based on the configuration in your `wrangler.toml` file and are used to populate `platform.env` during development and preview. Use the adapter config [`platformProxy` option](#options-platformProxy) to change your preferences for the bindings. +Cloudflare Workers specific values in the `platform` property are emulated during dev and preview modes. Local [bindings](https://developers.cloudflare.com/workers/wrangler/configuration/#bindings) are created based on the configuration in your `wrangler.toml` file and are used to populate `platform.env` during development and preview. Use the adapter config [`platformProxy` option](#options-platformproxy) to change your preferences for the bindings. For testing the build, you should use [wrangler](https://developers.cloudflare.com/workers/cli-wrangler) **version 3**. Once you have built your site, run `wrangler dev`.