@tsdoctor/manifest 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/README.md +63 -0
  2. package/index.d.ts +23 -23
  3. package/package.json +2 -2
package/README.md ADDED
@@ -0,0 +1,63 @@
1
+ # @tsdoctor/manifest
2
+
3
+ [![npm](https://img.shields.io/npm/v/@tsdoctor%2Fmanifest?label=npm&color=cb3837)](https://www.npmjs.com/package/@tsdoctor/manifest)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-4caf50.svg)](https://opensource.org/licenses/MIT)
5
+ [![Node.js %3E%3D24.11.0](https://img.shields.io/badge/Node.js-%3E%3D24.11.0-5fa04e.svg)](https://nodejs.org/)
6
+ [![TypeScript 6.0](https://img.shields.io/badge/TypeScript-6.0-3178c6.svg)](https://www.typescriptlang.org/)
7
+
8
+ The `tsdoctor.json` sidecar manifest: the spec-1 schema for a documented package's display identity, Open Graph images, SBOM pointer and registries, plus the encode/decode boundaries a writer and a reader each need. It depends on `effect` alone, so a bundler can emit `tsdoctor.json` through this package without pulling in `@tsdoctor/bundle`'s fetch, cache and discovery stack.
9
+
10
+ ## What you get
11
+
12
+ - **`BundleManifest`** — the manifest schema. `spec` is `1` and the only required field; every other field (`name`, `tagline`, `description`, a nested `project` identity, `openGraph`, `sbom`, `registries`) is additive. Unknown enum-ish values (`registries[].type`, `sbom.format`) degrade to a plain value rather than being rejected, so a reader that does not know a registry type still renders it as a link.
13
+ - **`decodeBundleManifest(input, path?)`** — the reader's boundary: `Schema.decodeUnknownEffect` over `BundleManifest`, failing typed `BundleManifestError` on a malformed file.
14
+ - **`encodeBundleManifest(manifest)`** — the writer's boundary: `Schema.encodeEffect` over `BundleManifest`, so an emitted file is by construction what `decodeBundleManifest` accepts.
15
+ - **`ManifestSource`** and **`decodeManifestSource(input, path?)`** — the shape an author checks in as a `tsdoctor.json` source file: `BundleManifest` minus `spec` and `project`, since a source file never declares its own spec version or the tier a monorepo project inherits.
16
+ - **`OpenGraphImage`, `OpenGraphConfig`, `SbomRef`, `RegistryRef`, `ProjectIdentity`, `KNOWN_REGISTRY_TYPES`, `isKnownRegistryType`** — the field-level schemas and helpers `BundleManifest` composes.
17
+ - **`MANIFEST_SPEC`, `TSDOCTOR_MANIFEST_FILENAME`** — the spec version this package reads and writes, and the sidecar's file name inside a bundle folder.
18
+
19
+ ## Install
20
+
21
+ ```bash
22
+ npm install @tsdoctor/manifest
23
+ # or
24
+ pnpm add @tsdoctor/manifest
25
+ ```
26
+
27
+ This is an ESM-only package. `effect` is a peer dependency.
28
+
29
+ ## Quick start
30
+
31
+ ```ts
32
+ import { Effect } from "effect";
33
+ import { decodeBundleManifest, encodeBundleManifest } from "@tsdoctor/manifest";
34
+
35
+ const program = Effect.gen(function* () {
36
+ const manifest = yield* decodeBundleManifest({
37
+ spec: 1,
38
+ name: "Kitchen Sink",
39
+ tagline: "Every API Extractor feature, one fixture",
40
+ openGraph: { images: [{ path: "og/kitchensink.png" }] },
41
+ });
42
+
43
+ // Round-trips: what encodeBundleManifest writes, decodeBundleManifest reads back.
44
+ const encoded = yield* encodeBundleManifest(manifest);
45
+ return encoded;
46
+ });
47
+ ```
48
+
49
+ ## Three boundaries, one file
50
+
51
+ `tsdoctor.json` has three readers, and each gets its own function rather than sharing one loosely-typed parser:
52
+
53
+ - **`decodeBundleManifest`** is what `@tsdoctor/bundle`'s layer-3 reader calls on a bundle's own `tsdoctor.json` — the fully resolved shape, `spec` and `project` included.
54
+ - **`encodeBundleManifest`** is what a bundler's meta pass calls to emit the file — going through the schema rather than `JSON.stringify` is what guarantees the two boundaries agree on shape.
55
+ - **`decodeManifestSource`** is what a bundler calls on an *authored* `tsdoctor.json` beside a package's `package.json`, or at a monorepo root — a source file never declares its own `spec` or `project`, because both are supplied by whichever tier assembles the final manifest.
56
+
57
+ ## Provenance
58
+
59
+ Moved out of `@tsdoctor/bundle` so `@savvy-web/bundler`'s meta pass — the one implementation of this file's authoring-time resolution — can depend on the writer boundary without dragging in the bundle package's `@effected/github`, `npm`, `store`, `xdg`, `glob` and `walker` peers. `@tsdoctor/bundle` re-exports every name here; consumers inside the tsdoctor monorepo import from `@tsdoctor/bundle`, and only writers import this package directly.
60
+
61
+ ## License
62
+
63
+ [MIT](LICENSE)
package/index.d.ts CHANGED
@@ -12,7 +12,7 @@ import { Effect, Schema } from "effect";
12
12
  *
13
13
  * @public
14
14
  */
15
- declare const KNOWN_REGISTRY_TYPES: readonly ["npm", "jsr"];
15
+ export declare const KNOWN_REGISTRY_TYPES: readonly ["npm", "jsr"];
16
16
  /**
17
17
  * A registry protocol family this reader recognizes.
18
18
  *
@@ -26,7 +26,7 @@ type KnownRegistryType = (typeof KNOWN_REGISTRY_TYPES)[number];
26
26
  *
27
27
  * @public
28
28
  */
29
- declare function isKnownRegistryType(type: string): type is KnownRegistryType;
29
+ export declare function isKnownRegistryType(type: string): type is KnownRegistryType;
30
30
  /**
31
31
  * One registry the documented package is published to.
32
32
  *
@@ -38,7 +38,7 @@ declare function isKnownRegistryType(type: string): type is KnownRegistryType;
38
38
  *
39
39
  * @public
40
40
  */
41
- declare const RegistryRef: Schema.Struct<{
41
+ export declare const RegistryRef: Schema.Struct<{
42
42
  /** The protocol family, e.g. `"npm"` or `"jsr"`. Unknown values are accepted. */
43
43
  readonly type: Schema.String;
44
44
  /** The human instance label, e.g. `"npm"` or `"Savvy Web Registry"`. */
@@ -51,7 +51,7 @@ declare const RegistryRef: Schema.Struct<{
51
51
  *
52
52
  * @public
53
53
  */
54
- type RegistryRef = typeof RegistryRef.Type;
54
+ export type RegistryRef = typeof RegistryRef.Type;
55
55
  /**
56
56
  * One Open Graph image declared by the manifest.
57
57
  *
@@ -65,7 +65,7 @@ type RegistryRef = typeof RegistryRef.Type;
65
65
  *
66
66
  * @public
67
67
  */
68
- declare const OpenGraphImage: Schema.Struct<{
68
+ export declare const OpenGraphImage: Schema.Struct<{
69
69
  /** Bundle-relative asset path. Mutually exclusive with `url`. */
70
70
  readonly path: Schema.optionalKey<Schema.String>;
71
71
  /** Absolute external URL, used verbatim. Mutually exclusive with `path`. */
@@ -84,7 +84,7 @@ declare const OpenGraphImage: Schema.Struct<{
84
84
  *
85
85
  * @public
86
86
  */
87
- type OpenGraphImage = typeof OpenGraphImage.Type;
87
+ export type OpenGraphImage = typeof OpenGraphImage.Type;
88
88
  /**
89
89
  * The manifest's Open Graph block: the asset-ish pieces only — most OG tags
90
90
  * are page-level and derive at render time in the consuming platform.
@@ -95,7 +95,7 @@ type OpenGraphImage = typeof OpenGraphImage.Type;
95
95
  *
96
96
  * @public
97
97
  */
98
- declare const OpenGraphConfig: Schema.Struct<{
98
+ export declare const OpenGraphConfig: Schema.Struct<{
99
99
  /** Declared images, first-wins per OG array semantics. */
100
100
  readonly images: Schema.optionalKey<Schema.$Array<Schema.Struct<{
101
101
  /** Bundle-relative asset path. Mutually exclusive with `url`. */
@@ -119,14 +119,14 @@ declare const OpenGraphConfig: Schema.Struct<{
119
119
  *
120
120
  * @public
121
121
  */
122
- type OpenGraphConfig = typeof OpenGraphConfig.Type;
122
+ export type OpenGraphConfig = typeof OpenGraphConfig.Type;
123
123
  /**
124
124
  * A pointer to the bundle's SBOM, computed by the bundler at publish and
125
125
  * served as a downloadable static asset.
126
126
  *
127
127
  * @public
128
128
  */
129
- declare const SbomRef: Schema.Struct<{
129
+ export declare const SbomRef: Schema.Struct<{
130
130
  /** Bundle-relative path to the SBOM file. */
131
131
  readonly path: Schema.String;
132
132
  /** SBOM format label, e.g. `"spdx-json"`. Unknown values are accepted. */
@@ -137,7 +137,7 @@ declare const SbomRef: Schema.Struct<{
137
137
  *
138
138
  * @public
139
139
  */
140
- type SbomRef = typeof SbomRef.Type;
140
+ export type SbomRef = typeof SbomRef.Type;
141
141
  /**
142
142
  * The inherited project tier, flattened into the emitted manifest by the
143
143
  * bundler (a fetched bundle has no parent directory to walk). Kept nested —
@@ -146,7 +146,7 @@ type SbomRef = typeof SbomRef.Type;
146
146
  *
147
147
  * @public
148
148
  */
149
- declare const ProjectIdentity: Schema.Struct<{
149
+ export declare const ProjectIdentity: Schema.Struct<{
150
150
  /** The project display name, e.g. `"Effected"` over leaf `@effected/store`. */
151
151
  readonly name: Schema.optionalKey<Schema.String>;
152
152
  /** The project tagline. */
@@ -157,7 +157,7 @@ declare const ProjectIdentity: Schema.Struct<{
157
157
  *
158
158
  * @public
159
159
  */
160
- type ProjectIdentity = typeof ProjectIdentity.Type;
160
+ export type ProjectIdentity = typeof ProjectIdentity.Type;
161
161
  /**
162
162
  * The versioned `tsdoctor.json` sidecar manifest — bundle layer 3.
163
163
  *
@@ -170,7 +170,7 @@ type ProjectIdentity = typeof ProjectIdentity.Type;
170
170
  *
171
171
  * @public
172
172
  */
173
- declare const BundleManifest: Schema.Struct<{
173
+ export declare const BundleManifest: Schema.Struct<{
174
174
  /** The integer spec version. This reader understands spec 1. */
175
175
  readonly spec: Schema.Literal<1>;
176
176
  /** Human display name (the npm name is dry; this one is SEO-friendly). */
@@ -228,7 +228,7 @@ declare const BundleManifest: Schema.Struct<{
228
228
  *
229
229
  * @public
230
230
  */
231
- type BundleManifest = typeof BundleManifest.Type;
231
+ export type BundleManifest = typeof BundleManifest.Type;
232
232
  declare const BundleManifestError_base: Schema.Class<BundleManifestError, Schema.TaggedStruct<"BundleManifestError", {
233
233
  /** The manifest file path, when the failure is tied to a file on disk. */
234
234
  readonly path: Schema.optionalKey<Schema.String>;
@@ -245,7 +245,7 @@ declare const BundleManifestError_base: Schema.Class<BundleManifestError, Schema
245
245
  *
246
246
  * @public
247
247
  */
248
- declare class BundleManifestError extends BundleManifestError_base {
248
+ export declare class BundleManifestError extends BundleManifestError_base {
249
249
  get message(): string;
250
250
  }
251
251
  /**
@@ -258,19 +258,19 @@ declare class BundleManifestError extends BundleManifestError_base {
258
258
  *
259
259
  * @public
260
260
  */
261
- declare function decodeBundleManifest(input: unknown, path?: string): Effect.Effect<BundleManifest, BundleManifestError>;
261
+ export declare function decodeBundleManifest(input: unknown, path?: string): Effect.Effect<BundleManifest, BundleManifestError>;
262
262
  /**
263
263
  * The manifest spec version this package reads and writes.
264
264
  *
265
265
  * @public
266
266
  */
267
- declare const MANIFEST_SPEC: 1;
267
+ export declare const MANIFEST_SPEC: 1;
268
268
  /**
269
269
  * The sidecar manifest's file name inside a bundle folder.
270
270
  *
271
271
  * @public
272
272
  */
273
- declare const TSDOCTOR_MANIFEST_FILENAME = "tsdoctor.json";
273
+ export declare const TSDOCTOR_MANIFEST_FILENAME = "tsdoctor.json";
274
274
  /**
275
275
  * Encode a {@link (BundleManifest:type)} into the JSON-ready value a writer
276
276
  * serializes as `tsdoctor.json`.
@@ -282,7 +282,7 @@ declare const TSDOCTOR_MANIFEST_FILENAME = "tsdoctor.json";
282
282
  *
283
283
  * @public
284
284
  */
285
- declare function encodeBundleManifest(manifest: BundleManifest): Effect.Effect<unknown, BundleManifestError>;
285
+ export declare function encodeBundleManifest(manifest: BundleManifest): Effect.Effect<unknown, BundleManifestError>;
286
286
  //#endregion
287
287
  //#region src/ManifestSource.d.ts
288
288
  /**
@@ -297,7 +297,7 @@ declare function encodeBundleManifest(manifest: BundleManifest): Effect.Effect<u
297
297
  *
298
298
  * @public
299
299
  */
300
- declare const ManifestSource: Schema.Struct<{
300
+ export declare const ManifestSource: Schema.Struct<{
301
301
  readonly name: Schema.optionalKey<Schema.String>;
302
302
  readonly tagline: Schema.optionalKey<Schema.String>;
303
303
  readonly description: Schema.optionalKey<Schema.String>;
@@ -327,13 +327,13 @@ declare const ManifestSource: Schema.Struct<{
327
327
  *
328
328
  * @public
329
329
  */
330
- type ManifestSource = typeof ManifestSource.Type;
330
+ export type ManifestSource = typeof ManifestSource.Type;
331
331
  /**
332
332
  * Decode an unknown value into a {@link (ManifestSource:type)}.
333
333
  *
334
334
  * @public
335
335
  */
336
- declare function decodeManifestSource(input: unknown, path?: string): Effect.Effect<ManifestSource, BundleManifestError>;
336
+ export declare function decodeManifestSource(input: unknown, path?: string): Effect.Effect<ManifestSource, BundleManifestError>;
337
337
  //#endregion
338
- export { BundleManifest, BundleManifestError, KNOWN_REGISTRY_TYPES, type KnownRegistryType, MANIFEST_SPEC, ManifestSource, OpenGraphConfig, OpenGraphImage, ProjectIdentity, RegistryRef, SbomRef, TSDOCTOR_MANIFEST_FILENAME, decodeBundleManifest, decodeManifestSource, encodeBundleManifest, isKnownRegistryType };
338
+ export type { KnownRegistryType };
339
339
  //# sourceMappingURL=index.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tsdoctor/manifest",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "private": false,
5
5
  "description": "The tsdoctor.json bundle manifest: the spec-1 schema, encode/decode boundaries and the authoring-file shape shared by bundlers that write it and readers that consume it.",
6
6
  "keywords": [
@@ -35,7 +35,7 @@
35
35
  "./package.json": "./package.json"
36
36
  },
37
37
  "peerDependencies": {
38
- "effect": "4.0.0-rc.109"
38
+ "effect": "4.0.0-rc.112"
39
39
  },
40
40
  "engines": {
41
41
  "node": ">=24.11.0"