This release adds support for SvelteKit 3 (#21). The SvelteKit plugin works with both SvelteKit 2 and 3, and npm no longer fails with ERESOLVE when altcha-lib is installed in a SvelteKit 3 project.
Compatibility: no changes to challenges, payloads or the public API. The SvelteKit plugin (altcha-lib/frameworks/sveltekit) is now ESM-only; see Upgrade notes. Every other entry point still ships both ESM and CommonJS builds.
Fixes
- SvelteKit 3 peer dependency. The optional
@sveltejs/kitpeer dependency now accepts^2.0.0 || ^3.0.0. Before, npm refused to installaltcha-libnext to@sveltejs/kit@3. - SvelteKit 3 types. SvelteKit 3 moved the
Handletype from@sveltejs/kitto@sveltejs/kit/hooks. The plugin no longer importsHandlefrom@sveltejs/kit, so it type-checks against both versions.createHandle()still returns SvelteKit's ownHandletype and can be passed tosequence()as before.
Changes
- The SvelteKit plugin is ESM-only.
@sveltejs/kitoffers only animportentry point, so it can't be loaded withrequire(). The CommonJS build of the plugin therefore failed on load withERR_PACKAGE_PATH_NOT_EXPORTED, and it has been removed. SvelteKit apps are ESM, so they are not affected. Response.json.challengeHandlerandverifyHandlerbuild their responses with the standardResponse.jsoninstead of SvelteKit'sjsonhelper, which SvelteKit 3 deprecates. Status codes,Content-Type,Cache-Controland response bodies are unchanged; SvelteKit's helper also setContent-Lengthexplicitly.
Upgrade notes
Most deployments need no changes.
- SvelteKit 3. Upgrade
altcha-lib, then remove any--legacy-peer-depsoroverridesyou added to work around the install error. Handlein your own hooks. On SvelteKit 3, importHandlefrom@sveltejs/kit/hooks. On SvelteKit 2, it stays in@sveltejs/kit. The hooks example indocs/sveltekit.mdshows the SvelteKit 3 form.- CommonJS.
require('altcha-lib/frameworks/sveltekit')now fails while the package is being resolved, with an error that namesaltcha-lib. Useimportinstead;import()also works from CommonJS files.
Full changelog: v2.6.0...v2.7.0