First frontend library (v1.0.0), co-shipped with realtime. Hybrid
model — no direct service access from the browser.
- endpoint<Req,Res>(path).get()/.post() — typed HTTP, auth-token
injection, structured errors, optional zod/valibot validate adapter.
- subscribe(topic, cb, {token, onTokenExpired}) — streaming-fetch SSE
with exponential-backoff reconnect, 401 token refresh, Last-Event-ID
resume.
- auth.login/logout/token over dev-defined endpoints.
- React (useTopic/useEndpoint + PicloudProvider) and Svelte
(topicStore/endpointStore) subpath exports.
Build: tsup (ESM+CJS+.d.ts); tests: vitest (15); lint: tsc --noEmit.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
19 lines
528 B
TypeScript
19 lines
528 B
TypeScript
import { defineConfig } from 'tsup';
|
|
|
|
// Dual ESM + CJS emit with .d.ts for the main entry and the two
|
|
// framework subpath exports. React and Svelte are peer deps — kept
|
|
// external so the lib never bundles a framework copy.
|
|
export default defineConfig({
|
|
entry: {
|
|
index: 'src/index.ts',
|
|
'react/index': 'src/react/index.ts',
|
|
'svelte/index': 'src/svelte/index.ts'
|
|
},
|
|
format: ['esm', 'cjs'],
|
|
dts: true,
|
|
clean: true,
|
|
sourcemap: true,
|
|
treeshake: true,
|
|
external: ['react', 'svelte', 'svelte/store']
|
|
});
|