@runtimescope/sveltekit
v0.10.7
Published
RuntimeScope for SvelteKit — one install, works in hooks.client.ts and hooks.server.ts
Maintainers
Readme
@runtimescope/sveltekit
One install for SvelteKit apps — hooks.client.ts + hooks.server.ts covered.
npm install @runtimescope/sveltekitSetup
1. Environment
# .env
RUNTIMESCOPE_DSN=runtimescope://proj_xxx@localhost:6768/my-app
PUBLIC_RUNTIMESCOPE_DSN=runtimescope://proj_xxx@localhost:6768/my-appSvelteKit exposes PUBLIC_* env vars to the browser automatically.
2. Client hook
// src/hooks.client.ts
import { initClient } from '@runtimescope/sveltekit/client';
initClient();3. Server hook
// src/hooks.server.ts
import { initServer } from '@runtimescope/sveltekit/server';
initServer();
export const handle = async ({ event, resolve }) => resolve(event);4. (Optional) Auto-wrap every request
import { sequence } from '@sveltejs/kit/hooks';
import { handleWithRuntimeScope } from '@runtimescope/sveltekit/server';
export const handle = sequence(handleWithRuntimeScope, myOtherHandle);Subpath Exports
| Import | Use in |
|--------|--------|
| @runtimescope/sveltekit | Shared utilities |
| @runtimescope/sveltekit/client | hooks.client.ts, browser-only files |
| @runtimescope/sveltekit/server | hooks.server.ts, +*.server.ts, endpoints |
Production Safety
If the DSN env vars are unset, the SDK is completely inert.
License
MIT
