library_json.ts

Library metadata: the curated package identity paired with analyzed source.

view source

Declarations
#

3 declarations

library_json_from_modules
#

library_json.ts view source

(package_json: { [x: string]: unknown; name: string; version?: string | undefined; private?: boolean | undefined; description?: string | undefined; tagline?: string | undefined; glyph?: string | undefined; ... 24 more ...; exports?: string | ... 2 more ... | undefined; }, modules: { ...; }[] | undefined, keys?: readonly string[]): LibraryJson import {library_json_from_modules} from '@fuzdev/fuz_util/library_json.js';

Builds a LibraryJson from a package.json and analyzed modules.

Curates package_json to the publish-safe PkgJson subset via pkg_json_from_package_json, so a full package.json (the common case from gro's loader or a JSON import) is accepted and stripped, while an already-curated PkgJson passes through unchanged.

keys overrides the curated field set, and must match the keys passed to the build-time strip (fuz_ui's vite_plugin_pkg_json): the re-strip here drops any field not in keys, so a wider build-time list with the default here would silently discard the extras. Pass the same shared list to both.

package_json

type { [x: string]: unknown; name: string; version?: string | undefined; private?: boolean | undefined; description?: string | undefined; tagline?: string | undefined; glyph?: string | undefined; logo?: string | undefined; ... 23 more ...; exports?: string | ... 2 more ... | undefined; }

modules

type { path: string; declarations?: ({ kind: "function"; name: string; returnType?: string | undefined; returnDescription?: string | undefined; parameters?: { name: string; type: string; optional?: boolean | undefined; rest?: boolean | undefined; description?: string | undefined; defaultValue?: string | undefined; proper...

keys

type readonly string[]
default pkg_json_keys

returns

LibraryJson

LibraryJson
#

library_json.ts view source

LibraryJson import type {LibraryJson} from '@fuzdev/fuz_util/library_json.js';

A library, as two clean projections of its inputs: pkg_json (the curated, publish-safe subset of package.json) and source_json (the svelte-docinfo analysis). Both are raw data — every derived value (repo url, npm url, published, the module/declaration hierarchy, …) is computed by the consumer (fuz_ui's Library class), not stored here, so nothing can go stale.

pkg_json

type PkgJson

source_json

type SourceJson

SourceJson
#

library_json.ts view source

SourceJson import type {SourceJson} from '@fuzdev/fuz_util/library_json.js';

A library's analyzed source: the module metadata produced by svelte-docinfo.

modules is typed as svelte-docinfo's wire shape (ModuleJsonInput), the input side where defaulted arrays and booleans may be absent. Its Vite plugin (virtual:svelte-docinfo) and CLI emit exactly this compacted shape; gro's loader instead hands back the parsed output-side superset (defaults materialized), which is structurally assignable and can be re-compacted to the wire shape with compactReplacer. Either way consumers must treat defaulted fields as optional. svelte-docinfo is an optional peer dependency — install it to type this field, otherwise the reference degrades to any.

modules?

type Array<ModuleJsonInput>

Depends on
#