mirror of
https://github.com/PR0M3TH3AN/bitlogin.git
synced 2026-10-27 08:31:21 +00:00
Integrators had to read the demo to learn the API: the package built via vite with no .d.ts and no types field, so @bitlogin/widget and @bitlogin/widget/session resolved to `any`. Emit declarations from source (tsconfig.types.json -> dist-types, build:types wired into build) and point the package types/exports conditions at them, for both the root and the /session entry. Generated, so they can't drift from the implementation. Add the type surface integrators actually want: - HTMLElementTagNameMap["bitlogin-auth"], so querySelector/createElement return the typed element. - Typed addEventListener/removeEventListener overloads (declaration-merged interface) for the bitlogin-* events. - Exported event-detail types and BitLoginEventMap (src/events.ts), matching element.ts's dispatchEvent shapes. Verified with a consumer conformance typecheck (typed detail with no cast, typed element methods, readCachedSession return type). README gains a "TypeScript" section. Addresses the ".d.ts / documented API surface" item of the Tessera integration feedback (docs/TODO.md). Co-Authored-By: Claude Opus 4.8 <[email protected]> Claude-Session: https://claude.ai/code/session_01BXQCvJPA6sVSQ5j8uBd9bB
36 lines
981 B
JSON
36 lines
981 B
JSON
{
|
|
"name": "@bitlogin/widget",
|
|
"version": "0.1.0",
|
|
"private": true,
|
|
"license": "MIT",
|
|
"type": "module",
|
|
"description": "BitLogin embeddable login widget: a <bitlogin-auth> custom element plus a window.nostr NIP-07-compatible provider, backed by a dedicated crypto Web Worker.",
|
|
"main": "./dist/bitlogin.js",
|
|
"types": "./dist-types/index.d.ts",
|
|
"exports": {
|
|
".": {
|
|
"types": "./dist-types/index.d.ts",
|
|
"default": "./dist/bitlogin.js"
|
|
},
|
|
"./session": {
|
|
"types": "./dist-types/session.d.ts",
|
|
"default": "./dist/bitlogin-session.js"
|
|
}
|
|
},
|
|
"scripts": {
|
|
"build": "vite build && npm run build:types",
|
|
"build:types": "tsc -p tsconfig.types.json",
|
|
"dev": "vite build --watch",
|
|
"typecheck": "tsc --noEmit"
|
|
},
|
|
"dependencies": {
|
|
"@bitlogin/core": "*",
|
|
"@getalby/bitcoin-connect": "3.12.3",
|
|
"qrcode-generator": "^2.0.4"
|
|
},
|
|
"devDependencies": {
|
|
"typescript": "^5.7.3",
|
|
"vite": "^6.1.0"
|
|
}
|
|
}
|