(package_json: { [x: string]: unknown; name: string; version: string; private?: boolean | undefined; description?: string | undefined; motto?: string | undefined; glyph?: string | undefined; logo?: string | undefined; ... 23 more ...; exports?: string | ... 2 more ... | undefined; }, source_json: { ...; }): LibraryOutputResult Generate the library.json and library.ts file contents. Parses at generation time so runtime only needs the pre-computed result.
Returns JSON + .ts wrapper because:
- JSON is natively importable by Node.js and Vite without TypeScript loaders
- Works in CI environments that don't have TS compilation
- The .ts wrapper validates with zod and exports with proper types
(JSON imports get widened types like string instead of literal unions)
package_json
{ [x: string]: unknown; name: string; version: string; private?: boolean | undefined; description?: string | undefined; motto?: string | undefined; glyph?: string | undefined; logo?: string | undefined; ... 23 more ...; exports?: string | ... 2 more ... | undefined; }source_json
{ [x: string]: unknown; name: string; version: string; modules?: { [x: string]: unknown; path: string; declarations?: { [x: string]: unknown; name: string; kind: "function" | "json" | "type" | "variable" | "class" | "constructor" | "component" | "css"; ... 19 more ...; alias_of?: { ...; } | undefined; }[] | undefine...returns
LibraryOutputResult