Skip to content

Releases: geoffrich/svelte-adapter-azure-swa

svelte-adapter-azure-swa v0.21.0

04 Mar 18:00
Compare
Choose a tag to compare

This release migrates the sk_render Azure function used for server-side request handling to v4 of the Node.js programming model. This should be a non-breaking change for most users, but some configuration options require changes.

Breaking changes

The server-side request handling Azure function's path has changed from /api/__render to /api/sk_render, since v4 does not allow routes starting with underscores. If you have any configuration relying on that path (unlikely), you will need to make updates to use the new path.

If you are setting the apiDir option and deploying other Azure functions with your Static Web App, this is a breaking change and you need to make the following updates:

  • Any other Azure functions you deploy with your Static Web App need to be migrated to the v4 programming model
  • The main field in your package.json needs to use a glob pattern that includes both the sk_render/index.js entrypoint as well as the entrypoints for your other Azure functions.
  • The SvelteKit Azure function now uses the prefix sk_render, so you can't have another Azure function using that prefix
  • If you are using a CUSTOM_BUILD_COMMAND, make sure to install dependencies inside the build/server folder

Features

Special thanks to @derkoe and @ktarmyshov for their PRs for this feature!

svelte-adapter-azure-swa v0.20.1

13 Jul 23:59
a86dff7
Compare
Choose a tag to compare

Bug Fixes

  • work around SWA issue with empty form bodies (#179) (d14aae1)

svelte-adapter-azure-swa v0.20.0

01 Jan 19:48
9b4d834
Compare
Choose a tag to compare

This version includes breaking changes in required dependencies:

  • Require SvelteKit version 2. See the SvelteKit v2 migration guide first to handle any SvelteKit breaking changes.
  • Require Node 18 or higher. If you previously set platform.apiRuntime to node:18 in the customStaticWebAppConfig, you can remove this setting.
  • Use esbuild 0.19.9 to build the deployed Azure function for SSR

IMPORTANT: since Azure's build system still defaults to Node 16 to build your app, you may need to set the engines field in your package.json to force it to build with Node 18. Node 16 is EOL and is not supported by SvelteKit v2.

Features

  • require SvelteKit 2 and Node 18 (c77c842)

svelte-adapter-azure-swa v0.19.1

20 Nov 01:09
Compare
Choose a tag to compare

Bug Fixes

  • do not rewrite /api and /data-api requests to SvelteKit (#162) (aa36771)
  • do not throw on parsing client principal (#160) (0fe3eaa)

svelte-adapter-azure-swa v0.19.0

17 Aug 15:10
1dc3918
Compare
Choose a tag to compare

Features

svelte-adapter-azure-swa v0.18.0

03 Aug 23:01
1b35c22
Compare
Choose a tag to compare

Features

svelte-adapter-azure-swa v0.17.0

02 Jul 22:19
47ca37c
Compare
Choose a tag to compare

This release contains two (likely non-breaking) features.

Allow customizing the node version

In production, your SvelteKit app will run a Node Azure Function to handle server requests. By default, this Azure Function uses Node 16. If you want to customize your Node version (version 18 is in public preview for Azure SWA), you can do so with the customStaticWebAppConfig adapter option to set platform.apiRuntime.

// svelte.config.js
import adapter from 'svelte-adapter-azure-swa';

/** @type {import('@sveltejs/kit').Config} */
const config = {
	kit: {
		adapter: adapter({
			customStaticWebAppConfig: {
				platform: {
					apiRuntime: 'node:18'
				}
			}
		})
	}
};

export default config;

Throw an error during build if the app declares /api routes

In production, Azure SWA will handle any request to routes starting with /api. If you also declare SvelteKit routes starting with /api, they will not be reachable in production and hitting them returns confusing errors (see #89 and #78 for context).

Because this, the adapter will now throw an error at build time and instruct you to rename the routes. If you do want to allow these routes for some reason, you can set allowReservedSwaRoutes in your adapter options. However, this will not start routing /api requests to your SvelteKit app, since SWA does not allow configuring the /api route.

Features

svelte-adapter-azure-swa v0.16.0

12 May 19:16
56a380b
Compare
Choose a tag to compare

Features

svelte-adapter-azure-swa v0.15.0

20 Mar 14:40
cd30083
Compare
Choose a tag to compare

Features

Bug Fixes

svelte-adapter-azure-swa v0.14.0

15 Mar 14:56
496d30c
Compare
Choose a tag to compare

Features

  • expose client principal through platform (#107) (e41f89c)

Bug Fixes

  • binary body is incorrectly parsed as UTF-8 (#123) (4869959)