@tsdoctor/bundle 0.8.2 → 0.9.0

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.
package/Bundle.js CHANGED
@@ -1,4 +1,4 @@
1
- import { BundleManifestError, decodeBundleManifest } from "@tsdoctor/manifest";
1
+ import { BundleManifestError, decodeBundleManifest } from "@effected/manifest";
2
2
  import { PackageJsonFile } from "@effected/package-json";
3
3
  import { TsconfigLoader } from "@effected/tsconfig-json";
4
4
  import { Effect, FileSystem, Option, Schema } from "effect";
@@ -13,7 +13,7 @@ const ApiModelHeader = Schema.Struct({ name: Schema.String });
13
13
  * Absence of layers 1–3 is the normal case (layers enrich, never gate) and
14
14
  * reads as `Option.none()`, never as this error. A file that exists but is
15
15
  * malformed is a real problem worth surfacing, not degrading past. Manifest
16
- * (layer 3) failures use {@link BundleManifestError} instead, so manifest
16
+ * (layer 3) failures use {@link @effected/manifest#BundleManifestError} instead, so manifest
17
17
  * consumers handle one tag across the file and non-file boundaries.
18
18
  *
19
19
  * @public
@@ -76,7 +76,7 @@ function readTsconfigLayer(tsconfigPath) {
76
76
  cause
77
77
  })));
78
78
  }
79
- /** Read layer 3 when the descriptor recorded a tsdoctor.json. */
79
+ /** Read layer 3 when the descriptor recorded a bundle.json. */
80
80
  function readManifestLayer(manifestPath) {
81
81
  if (manifestPath === void 0) return Effect.succeed(Option.none());
82
82
  return Effect.gen(function* () {
@@ -99,7 +99,7 @@ function readManifestLayer(manifestPath) {
99
99
  * Layer 0 is required; layers 1–3 read to `Option.none()` when the
100
100
  * descriptor recorded no file for them. A layer file that is present but
101
101
  * malformed fails typed ({@link BundleLayerError}, or
102
- * {@link BundleManifestError} for the manifest) — lenient about absence,
102
+ * {@link @effected/manifest#BundleManifestError} for the manifest) — lenient about absence,
103
103
  * strict about shape. `FileSystem` and `Path` stay in the `R` channel;
104
104
  * provide the platform layer once at the application boundary.
105
105
  *
@@ -1,5 +1,5 @@
1
1
  import { readApiModelInfo, readBundle } from "./Bundle.js";
2
- import { TSDOCTOR_MANIFEST_FILENAME } from "@tsdoctor/manifest";
2
+ import { BUNDLE_MANIFEST_FILENAME } from "@effected/manifest";
3
3
  import { LenientManifest } from "@effected/package-json";
4
4
  import { Effect, FileSystem, Option, Path, Schema } from "effect";
5
5
  import { GlobPatternOptions } from "@effected/glob";
@@ -136,7 +136,7 @@ function pickModelFile(dir, candidates, packageName) {
136
136
  * @remarks
137
137
  * Generalizes the RSPress plugin's `api.fromDir` helper, framework-neutral:
138
138
  * no route derivation — that stays in the adapter. Layer 0 (`*.api.json`) is
139
- * required; package.json, tsconfig.json and tsdoctor.json are recorded when
139
+ * required; package.json, tsconfig.json and bundle.json are recorded when
140
140
  * present. The package name comes from package.json when it has one, falling
141
141
  * back to the api.json model's own name; the version comes from package.json
142
142
  * alone. Caller overrides win over discovery. `FileSystem` and `Path` stay
@@ -159,7 +159,7 @@ function discoverBundle(dir, options) {
159
159
  const name = options?.overrides?.name ?? packageJsonName ?? (yield* readApiModelInfo(modelPath)).name;
160
160
  const version = options?.overrides?.version ?? (Option.isSome(packageJson) ? packageJson.value.version : void 0);
161
161
  const tsconfigPath = path.join(abs, "tsconfig.json");
162
- const manifestPath = path.join(abs, TSDOCTOR_MANIFEST_FILENAME);
162
+ const manifestPath = path.join(abs, BUNDLE_MANIFEST_FILENAME);
163
163
  const hasTsconfig = yield* fs.exists(tsconfigPath).pipe(Effect.orElseSucceed(() => false));
164
164
  const hasManifest = yield* fs.exists(manifestPath).pipe(Effect.orElseSucceed(() => false));
165
165
  return {
package/BundleFetch.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { readBundle } from "./Bundle.js";
2
2
  import { discoverBundle } from "./BundleDiscovery.js";
3
3
  import { isSafeAssetPath } from "./internal/asset-path.js";
4
- import { decodeBundleManifest } from "@tsdoctor/manifest";
4
+ import { decodeBundleManifest } from "@effected/manifest";
5
5
  import { Effect, FileSystem, Option, Path, Schema } from "effect";
6
6
  import { GitHubRelease, Repo, RepoRef } from "@effected/github";
7
7
  import { NpmRegistry, PackageTarball, PublishedVersion } from "@effected/npm";
@@ -1,4 +1,4 @@
1
- import { BundleManifestError, OpenGraphConfig, RegistryRef, SbomRef } from "@tsdoctor/manifest";
1
+ import { BundleManifestError, OpenGraphConfig, RegistryRef, SbomRef } from "@effected/manifest";
2
2
  import { Effect, Schema } from "effect";
3
3
 
4
4
  // src/PlatformOverrides.ts
@@ -35,7 +35,7 @@ const PlatformOverrides = Schema.Struct({
35
35
  *
36
36
  * @remarks
37
37
  * For adapters decoding raw platform options. Failures share
38
- * {@link BundleManifestError} — the platform tier is manifest data by another
38
+ * {@link @effected/manifest#BundleManifestError} — the platform tier is manifest data by another
39
39
  * route, and a caller handles both boundaries with one tag.
40
40
  *
41
41
  * @public
package/README.md CHANGED
@@ -5,7 +5,7 @@
5
5
  [![Node.js %3E%3D24.11.0](https://img.shields.io/badge/Node.js-%3E%3D24.11.0-5fa04e.svg)](https://nodejs.org/)
6
6
  [![TypeScript 6.0](https://img.shields.io/badge/TypeScript-6.0-3178c6.svg)](https://www.typescriptlang.org/)
7
7
 
8
- The tsdoctor bundle spec. A bundle is the folder of files that describes one documented package — an API Extractor `.api.json` model plus optional overlays — and this package owns everything about reading one: discovery on disk, the versioned `tsdoctor.json` sidecar manifest, resolution of manifest data across override tiers with per-field provenance, and canonical hashing of the inputs for change detection.
8
+ The tsdoctor bundle spec. A bundle is the folder of files that describes one documented package — an API Extractor `.api.json` model plus optional overlays — and this package owns everything about reading one: discovery on disk, the versioned `bundle.json` sidecar manifest, resolution of manifest data across override tiers with per-field provenance, and canonical hashing of the inputs for change detection.
9
9
 
10
10
  ## The layered bundle
11
11
 
@@ -16,12 +16,12 @@ A bundle is one required file plus optional overlays. Each layer enriches the re
16
16
  | 0 | `<name>.api.json` | yes | package name, the API itself |
17
17
  | 1 | `package.json` | no | version, description, dependencies and peers |
18
18
  | 2 | `tsconfig.json` | no | compiler options for the rendering environment |
19
- | 3 | `tsdoctor.json` | no | display identity, Open Graph, SBOM pointer, registries |
19
+ | 3 | `bundle.json` | no | display identity, Open Graph, SBOM pointer, registries |
20
20
 
21
21
  ## Install
22
22
 
23
23
  ```bash
24
- pnpm add @tsdoctor/bundle effect @effected/glob @effected/package-json @effected/tsconfig-json @effected/walker
24
+ pnpm add @tsdoctor/bundle effect @effected/manifest @effected/glob @effected/package-json @effected/tsconfig-json @effected/walker
25
25
  ```
26
26
 
27
27
  This is an ESM-only package. `effect` and the `@effected/*` packages are peer dependencies.
@@ -56,7 +56,7 @@ Every resolved field carries `{ value, source }`, so "did the user override this
56
56
  - `discoverBundle(dir)` / `discoverBundles(parentDir)` — resolve folder(s) into `BundleDescriptor`s (model file selection, name/version parsing, overlay detection).
57
57
  - `fetchNpmBundle` / `fetchGitHubReleaseBundle` — fetch a published bundle from any npm-protocol registry (via `@effected/npm`'s verified tarball pipeline) or from a GitHub release's `*.npm.meta.tgz` asset (via `@effected/github`), through a durable XDG cache (`@effected/store` + `@effected/xdg`). npm versions are immutable, so cache hits skip the network; `refresh: true` refetches.
58
58
  - `readBundle(descriptor)` / `loadBundle(dir)` / `loadBundles(parentDir)` — read the four layers into typed structures.
59
- - `BundleManifest`, `decodeBundleManifest` — the `tsdoctor.json` spec-1 schema; unknown fields and unknown registry types degrade gracefully instead of rejecting.
59
+ - `BundleManifest`, `decodeBundleManifest` — the `bundle.json` spec-1 schema, re-exported from `@effected/manifest`; unknown fields and unknown registry types degrade gracefully instead of rejecting.
60
60
  - `PlatformOverrides`, `decodePlatformOverrides` — the top-ranked data-override tier a consumer passes through platform options.
61
61
  - `resolveBundle` / `resolveBundleFrom` — the pure six-tier resolver producing a `ResolvedBundle` of `Provenanced` fields, with the documented inference rules (Open Graph alt-text chain, MIME from extension).
62
62
  - `hashLayerText`, `hashJsonValue`, `fingerprintResolvedBundle` — RFC 8785 (JCS) canonicalization plus SHA-256 (via `@effected/jsonc`'s `JsoncFingerprint`) for coarse (per-layer) and fine (per-field) change detection. Canonicalization is strict: an `undefined`-valued member or non-plain object fails typed rather than being silently dropped.
package/index.d.ts CHANGED
@@ -1,344 +1,13 @@
1
- import { Effect, FileSystem, Option, Path, Schema } from "effect";
1
+ import { BUNDLE_MANIFEST_FILENAME, BundleManifest, BundleManifest as BundleManifest$1, BundleManifestError, BundleManifestError as BundleManifestError$1, KNOWN_REGISTRY_TYPES, KnownRegistryType, MANIFEST_SPEC, ManifestSource, OpenGraphConfig, OpenGraphImage, ProjectIdentity, ProjectIdentity as ProjectIdentity$1, RegistryRef, RegistryRef as RegistryRef$1, SbomRef, SbomRef as SbomRef$1, decodeBundleManifest, decodeManifestSource, encodeBundleManifest, isKnownRegistryType } from "@effected/manifest";
2
2
  import { PackageManifest } from "@effected/package-json";
3
3
  import { CompilerOptions, ResolvedTsconfig } from "@effected/tsconfig-json";
4
+ import { Effect, FileSystem, Option, Path, Schema } from "effect";
4
5
  import { GitHubRelease } from "@effected/github";
5
6
  import { NpmRegistry, PackageTarball, RegistryTarget } from "@effected/npm";
6
7
  import { Cache } from "@effected/store";
7
8
  import { AppDirs } from "@effected/xdg";
8
9
  import { JsoncCanonicalizeError } from "@effected/jsonc";
9
10
  import { Digest } from "effect/crypto";
10
- /**
11
- * The registry protocol families this reader knows how to do more than link
12
- * to. `"npm"` means an npm-compatible registry — install commands and tarball
13
- * fetching work against any instance of it — and `"jsr"` the jsr protocol.
14
- *
15
- * @remarks
16
- * The manifest's `type` field is deliberately NOT constrained to these
17
- * values: unknown future types must degrade to link-only rendering, not
18
- * reject the manifest. Use {@link isKnownRegistryType} to branch.
19
- *
20
- * @public
21
- */
22
- export declare const KNOWN_REGISTRY_TYPES: readonly ["npm", "jsr"];
23
- /**
24
- * A registry protocol family this reader recognizes.
25
- *
26
- * @public
27
- */
28
- type KnownRegistryType = (typeof KNOWN_REGISTRY_TYPES)[number];
29
- /**
30
- * Whether a registry `type` value is a protocol family this reader
31
- * recognizes. `false` means the registry entry should degrade to link-only
32
- * rendering — it is never a validation failure.
33
- *
34
- * @public
35
- */
36
- export declare function isKnownRegistryType(type: string): type is KnownRegistryType;
37
- /**
38
- * One registry the documented package is published to.
39
- *
40
- * @remarks
41
- * `type` is the PROTOCOL FAMILY (`"npm"` covers every npm-compatible
42
- * registry), `name` the human instance label, `url` the package's page on
43
- * that instance. Unknown `type` values decode successfully and degrade to
44
- * link-only rendering (see {@link isKnownRegistryType}).
45
- *
46
- * @public
47
- */
48
- export declare const RegistryRef: Schema.Struct<{
49
- /** The protocol family, e.g. `"npm"` or `"jsr"`. Unknown values are accepted. */
50
- readonly type: Schema.String;
51
- /** The human instance label, e.g. `"npm"` or `"Savvy Web Registry"`. */
52
- readonly name: Schema.String;
53
- /** The package's URL on that registry instance. */
54
- readonly url: Schema.String;
55
- }>;
56
- /**
57
- * The decoded type of {@link (RegistryRef:variable)}.
58
- *
59
- * @public
60
- */
61
- export type RegistryRef = typeof RegistryRef.Type;
62
- /**
63
- * One Open Graph image declared by the manifest.
64
- *
65
- * @remarks
66
- * Exactly ONE of `path` (a bundle-relative asset the consuming platform
67
- * publishes and resolves to a URL) or `url` (an absolute external URL used
68
- * verbatim) must be present — the schema enforces the XOR. `type` is a MIME
69
- * type, inferred from the file extension by the resolver when omitted; `alt`
70
- * has a documented inference chain (tagline → description →
71
- * `"<name> API documentation"`).
72
- *
73
- * @public
74
- */
75
- export declare const OpenGraphImage: Schema.Struct<{
76
- /** Bundle-relative asset path. Mutually exclusive with `url`. */
77
- readonly path: Schema.optionalKey<Schema.String>;
78
- /** Absolute external URL, used verbatim. Mutually exclusive with `path`. */
79
- readonly url: Schema.optionalKey<Schema.String>;
80
- /** MIME type; inferred from the extension when omitted. */
81
- readonly type: Schema.optionalKey<Schema.String>;
82
- /** Pixel width; 1200×630 (1.91:1) is the cross-platform safe default. */
83
- readonly width: Schema.optionalKey<Schema.Int>;
84
- /** Pixel height. */
85
- readonly height: Schema.optionalKey<Schema.Int>;
86
- /** Alt text; inferred (tagline → description → fallback) when omitted. */
87
- readonly alt: Schema.optionalKey<Schema.String>;
88
- }>;
89
- /**
90
- * The decoded type of {@link (OpenGraphImage:variable)}.
91
- *
92
- * @public
93
- */
94
- export type OpenGraphImage = typeof OpenGraphImage.Type;
95
- /**
96
- * The manifest's Open Graph block: the asset-ish pieces only — most OG tags
97
- * are page-level and derive at render time in the consuming platform.
98
- *
99
- * @remarks
100
- * Multiple images follow OG array semantics: the first declared wins, extras
101
- * are alternates (e.g. a portrait 1000×1500 variant).
102
- *
103
- * @public
104
- */
105
- export declare const OpenGraphConfig: Schema.Struct<{
106
- /** Declared images, first-wins per OG array semantics. */
107
- readonly images: Schema.optionalKey<Schema.$Array<Schema.Struct<{
108
- /** Bundle-relative asset path. Mutually exclusive with `url`. */
109
- readonly path: Schema.optionalKey<Schema.String>;
110
- /** Absolute external URL, used verbatim. Mutually exclusive with `path`. */
111
- readonly url: Schema.optionalKey<Schema.String>;
112
- /** MIME type; inferred from the extension when omitted. */
113
- readonly type: Schema.optionalKey<Schema.String>;
114
- /** Pixel width; 1200×630 (1.91:1) is the cross-platform safe default. */
115
- readonly width: Schema.optionalKey<Schema.Int>;
116
- /** Pixel height. */
117
- readonly height: Schema.optionalKey<Schema.Int>;
118
- /** Alt text; inferred (tagline → description → fallback) when omitted. */
119
- readonly alt: Schema.optionalKey<Schema.String>;
120
- }>>>;
121
- /** Embed accent color (e.g. Discord), a CSS color string. */
122
- readonly themeColor: Schema.optionalKey<Schema.String>;
123
- }>;
124
- /**
125
- * The decoded type of {@link (OpenGraphConfig:variable)}.
126
- *
127
- * @public
128
- */
129
- export type OpenGraphConfig = typeof OpenGraphConfig.Type;
130
- /**
131
- * A pointer to the bundle's SBOM, computed by the bundler at publish and
132
- * served as a downloadable static asset.
133
- *
134
- * @public
135
- */
136
- export declare const SbomRef: Schema.Struct<{
137
- /** Bundle-relative path to the SBOM file. */
138
- readonly path: Schema.String;
139
- /** SBOM format label, e.g. `"spdx-json"`. Unknown values are accepted. */
140
- readonly format: Schema.optionalKey<Schema.String>;
141
- }>;
142
- /**
143
- * The decoded type of {@link (SbomRef:variable)}.
144
- *
145
- * @public
146
- */
147
- export type SbomRef = typeof SbomRef.Type;
148
- /**
149
- * The inherited project tier, flattened into the emitted manifest by the
150
- * bundler (a fetched bundle has no parent directory to walk). Kept nested —
151
- * structurally distinguishable from the leaf fields — because provenance is
152
- * load-bearing for override detection.
153
- *
154
- * @public
155
- */
156
- export declare const ProjectIdentity: Schema.Struct<{
157
- /** The project display name, e.g. `"Effected"` over leaf `@effected/store`. */
158
- readonly name: Schema.optionalKey<Schema.String>;
159
- /** The project tagline. */
160
- readonly tagline: Schema.optionalKey<Schema.String>;
161
- }>;
162
- /**
163
- * The decoded type of {@link (ProjectIdentity:variable)}.
164
- *
165
- * @public
166
- */
167
- export type ProjectIdentity = typeof ProjectIdentity.Type;
168
- /**
169
- * The versioned `tsdoctor.json` sidecar manifest — bundle layer 3.
170
- *
171
- * @remarks
172
- * `spec` is the only required field; every other field enriches. Unknown
173
- * top-level fields are ignored on decode (additive fields are minor spec
174
- * revisions) and unknown enum-ish values (registry `type`, sbom `format`)
175
- * degrade gracefully instead of rejecting — an old reader must be able to
176
- * consume a new bundle.
177
- *
178
- * @public
179
- */
180
- export declare const BundleManifest: Schema.Struct<{
181
- /** The integer spec version. This reader understands spec 1. */
182
- readonly spec: Schema.Literal<1>;
183
- /** Human display name (the npm name is dry; this one is SEO-friendly). */
184
- readonly name: Schema.optionalKey<Schema.String>;
185
- /** Short tagline. */
186
- readonly tagline: Schema.optionalKey<Schema.String>;
187
- /** Long description; overrides the package.json description when present. */
188
- readonly description: Schema.optionalKey<Schema.String>;
189
- /** The inherited project tier, flattened in at emit time. */
190
- readonly project: Schema.optionalKey<Schema.Struct<{
191
- /** The project display name, e.g. `"Effected"` over leaf `@effected/store`. */
192
- readonly name: Schema.optionalKey<Schema.String>;
193
- /** The project tagline. */
194
- readonly tagline: Schema.optionalKey<Schema.String>;
195
- }>>;
196
- /** Open Graph assets. */
197
- readonly openGraph: Schema.optionalKey<Schema.Struct<{
198
- /** Declared images, first-wins per OG array semantics. */
199
- readonly images: Schema.optionalKey<Schema.$Array<Schema.Struct<{
200
- /** Bundle-relative asset path. Mutually exclusive with `url`. */
201
- readonly path: Schema.optionalKey<Schema.String>;
202
- /** Absolute external URL, used verbatim. Mutually exclusive with `path`. */
203
- readonly url: Schema.optionalKey<Schema.String>;
204
- /** MIME type; inferred from the extension when omitted. */
205
- readonly type: Schema.optionalKey<Schema.String>;
206
- /** Pixel width; 1200×630 (1.91:1) is the cross-platform safe default. */
207
- readonly width: Schema.optionalKey<Schema.Int>;
208
- /** Pixel height. */
209
- readonly height: Schema.optionalKey<Schema.Int>;
210
- /** Alt text; inferred (tagline → description → fallback) when omitted. */
211
- readonly alt: Schema.optionalKey<Schema.String>;
212
- }>>>;
213
- /** Embed accent color (e.g. Discord), a CSS color string. */
214
- readonly themeColor: Schema.optionalKey<Schema.String>;
215
- }>>;
216
- /** SBOM pointer. */
217
- readonly sbom: Schema.optionalKey<Schema.Struct<{
218
- /** Bundle-relative path to the SBOM file. */
219
- readonly path: Schema.String;
220
- /** SBOM format label, e.g. `"spdx-json"`. Unknown values are accepted. */
221
- readonly format: Schema.optionalKey<Schema.String>;
222
- }>>;
223
- /** Registries the package is published to. */
224
- readonly registries: Schema.optionalKey<Schema.$Array<Schema.Struct<{
225
- /** The protocol family, e.g. `"npm"` or `"jsr"`. Unknown values are accepted. */
226
- readonly type: Schema.String;
227
- /** The human instance label, e.g. `"npm"` or `"Savvy Web Registry"`. */
228
- readonly name: Schema.String;
229
- /** The package's URL on that registry instance. */
230
- readonly url: Schema.String;
231
- }>>>;
232
- }>;
233
- /**
234
- * The decoded type of {@link (BundleManifest:variable)}.
235
- *
236
- * @public
237
- */
238
- export type BundleManifest = typeof BundleManifest.Type;
239
- declare const BundleManifestError_base: Schema.Class<BundleManifestError, Schema.TaggedStruct<"BundleManifestError", {
240
- /** The manifest file path, when the failure is tied to a file on disk. */
241
- readonly path: Schema.optionalKey<Schema.String>;
242
- /** The underlying failure (JSON syntax or schema decode), preserved structurally. */
243
- readonly cause: Schema.Defect;
244
- }>, import("effect/Cause").YieldableError>;
245
- /**
246
- * Raised when a present `tsdoctor.json` cannot be parsed or does not satisfy
247
- * the {@link (BundleManifest:variable)} schema.
248
- *
249
- * @remarks
250
- * Absence of the manifest is NEVER this error — layers enrich, never gate,
251
- * so a missing sidecar is the normal case and reads as `Option.none()`.
252
- *
253
- * @public
254
- */
255
- export declare class BundleManifestError extends BundleManifestError_base {
256
- get message(): string;
257
- }
258
- /**
259
- * Decode an unknown value into a {@link (BundleManifest:type)}.
260
- *
261
- * @remarks
262
- * The typed boundary for manifest input that has already been parsed from
263
- * JSON (plugin options, fetched payloads). File-based reading lives in
264
- * `readBundle`, which routes through this after parsing.
265
- *
266
- * @public
267
- */
268
- export declare function decodeBundleManifest(input: unknown, path?: string): Effect.Effect<BundleManifest, BundleManifestError>;
269
- /**
270
- * The manifest spec version this package reads and writes.
271
- *
272
- * @public
273
- */
274
- export declare const MANIFEST_SPEC: 1;
275
- /**
276
- * The sidecar manifest's file name inside a bundle folder.
277
- *
278
- * @public
279
- */
280
- export declare const TSDOCTOR_MANIFEST_FILENAME = "tsdoctor.json";
281
- /**
282
- * Encode a {@link (BundleManifest:type)} into the JSON-ready value a writer
283
- * serializes as `tsdoctor.json`.
284
- *
285
- * @remarks
286
- * The writer's boundary. Going through the schema rather than
287
- * `JSON.stringify` means an emitted file is by construction what
288
- * {@link decodeBundleManifest} accepts.
289
- *
290
- * @public
291
- */
292
- export declare function encodeBundleManifest(manifest: BundleManifest): Effect.Effect<unknown, BundleManifestError>;
293
- /**
294
- * The shape an author checks in as a `tsdoctor.json` SOURCE file, at a
295
- * package root (the leaf tier) or a workspace root (the project tier).
296
- *
297
- * @remarks
298
- * `BundleManifest` minus `spec` and `project`: a source file never declares
299
- * its own spec version, and it never declares its inherited tier — the
300
- * bundler supplies both when it flattens the hierarchy at emit time. Decoded
301
- * only by writers; readers never see this shape.
302
- *
303
- * @public
304
- */
305
- export declare const ManifestSource: Schema.Struct<{
306
- readonly name: Schema.optionalKey<Schema.String>;
307
- readonly tagline: Schema.optionalKey<Schema.String>;
308
- readonly description: Schema.optionalKey<Schema.String>;
309
- readonly openGraph: Schema.optionalKey<Schema.Struct<{
310
- readonly images: Schema.optionalKey<Schema.$Array<Schema.Struct<{
311
- readonly path: Schema.optionalKey<Schema.String>;
312
- readonly url: Schema.optionalKey<Schema.String>;
313
- readonly type: Schema.optionalKey<Schema.String>;
314
- readonly width: Schema.optionalKey<Schema.Int>;
315
- readonly height: Schema.optionalKey<Schema.Int>;
316
- readonly alt: Schema.optionalKey<Schema.String>;
317
- }>>>;
318
- readonly themeColor: Schema.optionalKey<Schema.String>;
319
- }>>;
320
- readonly sbom: Schema.optionalKey<Schema.Struct<{
321
- readonly path: Schema.String;
322
- readonly format: Schema.optionalKey<Schema.String>;
323
- }>>;
324
- readonly registries: Schema.optionalKey<Schema.$Array<Schema.Struct<{
325
- readonly type: Schema.String;
326
- readonly name: Schema.String;
327
- readonly url: Schema.String;
328
- }>>>;
329
- }>;
330
- /**
331
- * The decoded type of {@link (ManifestSource:variable)}.
332
- *
333
- * @public
334
- */
335
- export type ManifestSource = typeof ManifestSource.Type;
336
- /**
337
- * Decode an unknown value into a {@link (ManifestSource:type)}.
338
- *
339
- * @public
340
- */
341
- export declare function decodeManifestSource(input: unknown, path?: string): Effect.Effect<ManifestSource, BundleManifestError>;
342
11
  /**
343
12
  * The subset of a `<name>.api.json` model this package reads: the package
344
13
  * name from the model's own metadata.
@@ -370,7 +39,7 @@ declare const BundleLayerError_base: Schema.Class<BundleLayerError, Schema.Tagge
370
39
  * Absence of layers 1–3 is the normal case (layers enrich, never gate) and
371
40
  * reads as `Option.none()`, never as this error. A file that exists but is
372
41
  * malformed is a real problem worth surfacing, not degrading past. Manifest
373
- * (layer 3) failures use {@link BundleManifestError} instead, so manifest
42
+ * (layer 3) failures use {@link @effected/manifest#BundleManifestError} instead, so manifest
374
43
  * consumers handle one tag across the file and non-file boundaries.
375
44
  *
376
45
  * @public
@@ -405,7 +74,7 @@ interface BundleDescriptor {
405
74
  readonly packageJsonPath?: string;
406
75
  /** Absolute path to the layer-2 tsconfig.json, when present. */
407
76
  readonly tsconfigPath?: string;
408
- /** Absolute path to the layer-3 tsdoctor.json manifest, when present. */
77
+ /** Absolute path to the layer-3 bundle.json manifest, when present. */
409
78
  readonly manifestPath?: string;
410
79
  }
411
80
  /**
@@ -423,8 +92,8 @@ interface Bundle {
423
92
  readonly packageJson: Option.Option<PackageManifest>;
424
93
  /** Layer 2: the tsconfig, extends-resolved. */
425
94
  readonly tsconfig: Option.Option<ResolvedTsconfig>;
426
- /** Layer 3: the tsdoctor.json sidecar manifest. */
427
- readonly manifest: Option.Option<BundleManifest>;
95
+ /** Layer 3: the bundle.json sidecar manifest. */
96
+ readonly manifest: Option.Option<BundleManifest$1>;
428
97
  }
429
98
  /**
430
99
  * Read the layer-0 model header — the package name — from a `*.api.json`
@@ -444,13 +113,13 @@ export declare function readApiModelInfo(modelPath: string): Effect.Effect<ApiMo
444
113
  * Layer 0 is required; layers 1–3 read to `Option.none()` when the
445
114
  * descriptor recorded no file for them. A layer file that is present but
446
115
  * malformed fails typed ({@link BundleLayerError}, or
447
- * {@link BundleManifestError} for the manifest) — lenient about absence,
116
+ * {@link @effected/manifest#BundleManifestError} for the manifest) — lenient about absence,
448
117
  * strict about shape. `FileSystem` and `Path` stay in the `R` channel;
449
118
  * provide the platform layer once at the application boundary.
450
119
  *
451
120
  * @public
452
121
  */
453
- export declare function readBundle(descriptor: BundleDescriptor): Effect.Effect<Bundle, BundleLayerError | BundleManifestError, FileSystem.FileSystem | Path.Path>;
122
+ export declare function readBundle(descriptor: BundleDescriptor): Effect.Effect<Bundle, BundleLayerError | BundleManifestError$1, FileSystem.FileSystem | Path.Path>;
454
123
  /**
455
124
  * The `manifest.platform` tier: a data-override object a consumer passes
456
125
  * through platform options (e.g. `ApiExtractorPlugin(options)`), sitting at
@@ -507,12 +176,12 @@ export type PlatformOverrides = typeof PlatformOverrides.Type;
507
176
  *
508
177
  * @remarks
509
178
  * For adapters decoding raw platform options. Failures share
510
- * {@link BundleManifestError} — the platform tier is manifest data by another
179
+ * {@link @effected/manifest#BundleManifestError} — the platform tier is manifest data by another
511
180
  * route, and a caller handles both boundaries with one tag.
512
181
  *
513
182
  * @public
514
183
  */
515
- export declare function decodePlatformOverrides(input: unknown): Effect.Effect<PlatformOverrides, BundleManifestError>;
184
+ export declare function decodePlatformOverrides(input: unknown): Effect.Effect<PlatformOverrides, BundleManifestError$1>;
516
185
  /**
517
186
  * Where a resolved field's value came from, highest-ranked tier first.
518
187
  *
@@ -595,13 +264,13 @@ interface ResolvedBundle {
595
264
  /** Description: platform → leaf manifest → package.json. */
596
265
  readonly description?: Provenanced<string>;
597
266
  /** The project identity block, when the manifest carries one. */
598
- readonly project?: Provenanced<ProjectIdentity>;
267
+ readonly project?: Provenanced<ProjectIdentity$1>;
599
268
  /** Open Graph block: platform → leaf manifest, with per-image inference applied. */
600
269
  readonly openGraph?: Provenanced<ResolvedOpenGraph>;
601
270
  /** SBOM pointer: platform → leaf manifest. */
602
- readonly sbom?: Provenanced<SbomRef>;
271
+ readonly sbom?: Provenanced<SbomRef$1>;
603
272
  /** Registries: platform → leaf manifest. */
604
- readonly registries?: Provenanced<ReadonlyArray<RegistryRef>>;
273
+ readonly registries?: Provenanced<ReadonlyArray<RegistryRef$1>>;
605
274
  /** Runtime dependencies from package.json, key-sorted. Feeds the type registry's rendering scope. */
606
275
  readonly dependencies?: Provenanced<Readonly<Record<string, string>>>;
607
276
  /** Peer dependencies from package.json, key-sorted. Feeds the type registry's rendering scope. */
@@ -622,8 +291,8 @@ interface ResolveBundleInput {
622
291
  readonly packageJson?: PackageManifest;
623
292
  /** Layer 2: the extends-resolved tsconfig, when present. */
624
293
  readonly tsconfig?: ResolvedTsconfig;
625
- /** Layer 3: the tsdoctor.json sidecar manifest, when present. */
626
- readonly manifest?: BundleManifest;
294
+ /** Layer 3: the bundle.json sidecar manifest, when present. */
295
+ readonly manifest?: BundleManifest$1;
627
296
  /** The `manifest.platform` tier, from platform options. */
628
297
  readonly platform?: PlatformOverrides;
629
298
  }
@@ -785,7 +454,7 @@ interface DiscoverBundlesOptions {
785
454
  * @remarks
786
455
  * Generalizes the RSPress plugin's `api.fromDir` helper, framework-neutral:
787
456
  * no route derivation — that stays in the adapter. Layer 0 (`*.api.json`) is
788
- * required; package.json, tsconfig.json and tsdoctor.json are recorded when
457
+ * required; package.json, tsconfig.json and bundle.json are recorded when
789
458
  * present. The package name comes from package.json when it has one, falling
790
459
  * back to the api.json model's own name; the version comes from package.json
791
460
  * alone. Caller overrides win over discovery. `FileSystem` and `Path` stay
@@ -814,13 +483,13 @@ export declare function discoverBundles(parentDir: string, options?: DiscoverBun
814
483
  *
815
484
  * @public
816
485
  */
817
- export declare function loadBundle(dir: string, options?: DiscoverBundleOptions): Effect.Effect<Bundle, BundleDiscoveryError | BundleLayerError | BundleManifestError, FileSystem.FileSystem | Path.Path>;
486
+ export declare function loadBundle(dir: string, options?: DiscoverBundleOptions): Effect.Effect<Bundle, BundleDiscoveryError | BundleLayerError | BundleManifestError$1, FileSystem.FileSystem | Path.Path>;
818
487
  /**
819
488
  * Discover and read every bundle under a parent directory in one call.
820
489
  *
821
490
  * @public
822
491
  */
823
- export declare function loadBundles(parentDir: string, options?: DiscoverBundlesOptions): Effect.Effect<ReadonlyArray<Bundle>, BundleDiscoveryError | BundleLayerError | BundleManifestError, FileSystem.FileSystem | Path.Path>;
492
+ export declare function loadBundles(parentDir: string, options?: DiscoverBundlesOptions): Effect.Effect<ReadonlyArray<Bundle>, BundleDiscoveryError | BundleLayerError | BundleManifestError$1, FileSystem.FileSystem | Path.Path>;
824
493
  declare const BundleFetchError_base: Schema.Class<BundleFetchError, Schema.TaggedStruct<"BundleFetchError", {
825
494
  /** Which fetcher failed. */
826
495
  readonly source: Schema.Literals<readonly ["npm", "github"]>;
@@ -914,7 +583,7 @@ interface FetchGitHubReleaseBundleOptions {
914
583
  *
915
584
  * @public
916
585
  */
917
- export declare function fetchNpmBundle(options: FetchNpmBundleOptions): Effect.Effect<Bundle, BundleFetchError | BundleLayerError | BundleManifestError, NpmRegistry | PackageTarball | Cache | AppDirs | FileSystem.FileSystem | Path.Path>;
586
+ export declare function fetchNpmBundle(options: FetchNpmBundleOptions): Effect.Effect<Bundle, BundleFetchError | BundleLayerError | BundleManifestError$1, NpmRegistry | PackageTarball | Cache | AppDirs | FileSystem.FileSystem | Path.Path>;
918
587
  /**
919
588
  * Fetch a bundle attached to a GitHub release as a `*.npm.meta.tgz`-style
920
589
  * asset, through the durable XDG cache.
@@ -936,7 +605,7 @@ export declare function fetchNpmBundle(options: FetchNpmBundleOptions): Effect.E
936
605
  *
937
606
  * @public
938
607
  */
939
- export declare function fetchGitHubReleaseBundle(options: FetchGitHubReleaseBundleOptions): Effect.Effect<Bundle, BundleFetchError | BundleLayerError | BundleManifestError, GitHubRelease | PackageTarball | Cache | AppDirs | FileSystem.FileSystem | Path.Path>;
608
+ export declare function fetchGitHubReleaseBundle(options: FetchGitHubReleaseBundleOptions): Effect.Effect<Bundle, BundleFetchError | BundleLayerError | BundleManifestError$1, GitHubRelease | PackageTarball | Cache | AppDirs | FileSystem.FileSystem | Path.Path>;
940
609
  /**
941
610
  * Normalize text for hashing: CRLF/CR line endings become LF and trailing
942
611
  * whitespace at the end of the content is trimmed.
@@ -1012,5 +681,5 @@ export declare function hashLayerText(text: string): Effect.Effect<string, never
1012
681
  * @public
1013
682
  */
1014
683
  export declare function fingerprintResolvedBundle(resolved: ResolvedBundle): Effect.Effect<Readonly<Record<string, string>>, never, Digest.Digest>;
1015
- export type { ApiModelInfo, Bundle, BundleDescriptor, BundleOverrides, DiscoverBundleOptions, DiscoverBundlesOptions, FetchGitHubReleaseBundleOptions, FetchNpmBundleOptions, KnownRegistryType, ProvenanceSource, Provenanced, PublishBundleAssetsInput, PublishedOpenGraphImage, ResolveBundleInput, ResolvedBundle, ResolvedOpenGraph, ResolvedOpenGraphImage };
684
+ export { type ApiModelInfo, BUNDLE_MANIFEST_FILENAME, type Bundle, type BundleDescriptor, BundleManifest, BundleManifestError, type BundleOverrides, type DiscoverBundleOptions, type DiscoverBundlesOptions, type FetchGitHubReleaseBundleOptions, type FetchNpmBundleOptions, KNOWN_REGISTRY_TYPES, type KnownRegistryType, MANIFEST_SPEC, ManifestSource, OpenGraphConfig, OpenGraphImage, ProjectIdentity, type ProvenanceSource, type Provenanced, type PublishBundleAssetsInput, type PublishedOpenGraphImage, RegistryRef, type ResolveBundleInput, type ResolvedBundle, type ResolvedOpenGraph, type ResolvedOpenGraphImage, SbomRef, decodeBundleManifest, decodeManifestSource, encodeBundleManifest, isKnownRegistryType };
1016
685
  //# sourceMappingURL=index.d.ts.map
package/index.js CHANGED
@@ -5,6 +5,6 @@ import { BundleFetchError, fetchGitHubReleaseBundle, fetchNpmBundle } from "./Bu
5
5
  import { fingerprintResolvedBundle, hashJsonValue, hashLayerText, hashText, normalizeText } from "./BundleHash.js";
6
6
  import { resolveBundle, resolveBundleFrom } from "./BundleResolver.js";
7
7
  import { PlatformOverrides, decodePlatformOverrides } from "./PlatformOverrides.js";
8
- import { BundleManifest, BundleManifestError, KNOWN_REGISTRY_TYPES, MANIFEST_SPEC, ManifestSource, OpenGraphConfig, OpenGraphImage, ProjectIdentity, RegistryRef, SbomRef, TSDOCTOR_MANIFEST_FILENAME, decodeBundleManifest, decodeManifestSource, encodeBundleManifest, isKnownRegistryType } from "@tsdoctor/manifest";
8
+ import { BUNDLE_MANIFEST_FILENAME, BundleManifest, BundleManifestError, KNOWN_REGISTRY_TYPES, MANIFEST_SPEC, ManifestSource, OpenGraphConfig, OpenGraphImage, ProjectIdentity, RegistryRef, SbomRef, decodeBundleManifest, decodeManifestSource, encodeBundleManifest, isKnownRegistryType } from "@effected/manifest";
9
9
 
10
- export { BundleAssetError, BundleDiscoveryError, BundleFetchError, BundleLayerError, BundleManifest, BundleManifestError, KNOWN_REGISTRY_TYPES, MANIFEST_SPEC, ManifestSource, OpenGraphConfig, OpenGraphImage, PlatformOverrides, ProjectIdentity, RegistryRef, SbomRef, TSDOCTOR_MANIFEST_FILENAME, decodeBundleManifest, decodeManifestSource, decodePlatformOverrides, discoverBundle, discoverBundles, encodeBundleManifest, fetchGitHubReleaseBundle, fetchNpmBundle, fingerprintResolvedBundle, hashJsonValue, hashLayerText, hashText, isKnownRegistryType, loadBundle, loadBundles, normalizeText, publishBundleAssets, readApiModelInfo, readBundle, resolveBundle, resolveBundleFrom };
10
+ export { BUNDLE_MANIFEST_FILENAME, BundleAssetError, BundleDiscoveryError, BundleFetchError, BundleLayerError, BundleManifest, BundleManifestError, KNOWN_REGISTRY_TYPES, MANIFEST_SPEC, ManifestSource, OpenGraphConfig, OpenGraphImage, PlatformOverrides, ProjectIdentity, RegistryRef, SbomRef, decodeBundleManifest, decodeManifestSource, decodePlatformOverrides, discoverBundle, discoverBundles, encodeBundleManifest, fetchGitHubReleaseBundle, fetchNpmBundle, fingerprintResolvedBundle, hashJsonValue, hashLayerText, hashText, isKnownRegistryType, loadBundle, loadBundles, normalizeText, publishBundleAssets, readApiModelInfo, readBundle, resolveBundle, resolveBundleFrom };
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@tsdoctor/bundle",
3
- "version": "0.8.2",
3
+ "version": "0.9.0",
4
4
  "private": false,
5
- "description": "The tsdoctor bundle spec: layered bundle discovery, the versioned tsdoctor.json sidecar manifest, provenance-carrying resolution and canonical input hashing for API documentation bundles.",
5
+ "description": "The tsdoctor bundle spec: layered bundle discovery, the versioned bundle.json sidecar manifest, provenance-carrying resolution and canonical input hashing for API documentation bundles.",
6
6
  "keywords": [
7
7
  "api-extractor",
8
8
  "bundle",
@@ -46,12 +46,12 @@
46
46
  "peerDependencies": {
47
47
  "@effected/github": "^0.30.0",
48
48
  "@effected/jsonc": "^0.24.0",
49
- "@effected/npm": "^0.31.0",
50
- "@effected/package-json": "^0.31.0",
49
+ "@effected/manifest": "^0.1.0",
50
+ "@effected/npm": "^0.32.0",
51
+ "@effected/package-json": "^0.31.1",
51
52
  "@effected/store": "^0.24.0",
52
53
  "@effected/tsconfig-json": "^0.20.2",
53
54
  "@effected/xdg": "^0.19.2",
54
- "@tsdoctor/manifest": "0.4.0",
55
55
  "effect": "~4.1.2"
56
56
  },
57
57
  "engines": {