@tsdoctor/bundle 0.2.2 → 0.2.4
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 +1 -7
- package/PlatformOverrides.js +1 -1
- package/index.d.ts +74 -4
- package/index.js +3 -3
- package/package.json +4 -3
- package/BundleManifest.js +0 -183
package/Bundle.js
CHANGED
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import { BundleManifestError, decodeBundleManifest } from "
|
|
1
|
+
import { BundleManifestError, TSDOCTOR_MANIFEST_FILENAME, decodeBundleManifest } from "@tsdoctor/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";
|
|
5
5
|
|
|
6
6
|
//#region src/Bundle.ts
|
|
7
|
-
/**
|
|
8
|
-
* The sidecar manifest's file name inside a bundle folder.
|
|
9
|
-
*
|
|
10
|
-
* @public
|
|
11
|
-
*/
|
|
12
|
-
const TSDOCTOR_MANIFEST_FILENAME = "tsdoctor.json";
|
|
13
7
|
/** The minimal api.json shape the layer-0 reader validates. */
|
|
14
8
|
const ApiModelHeader = Schema.Struct({ name: Schema.String });
|
|
15
9
|
/**
|
package/PlatformOverrides.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BundleManifestError, OpenGraphConfig, RegistryRef, SbomRef } from "
|
|
1
|
+
import { BundleManifestError, OpenGraphConfig, RegistryRef, SbomRef } from "@tsdoctor/manifest";
|
|
2
2
|
import { Effect, Schema } from "effect";
|
|
3
3
|
|
|
4
4
|
//#region src/PlatformOverrides.ts
|
package/index.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import { Crypto, Effect, FileSystem, Option, Path, PlatformError, Schema } from "effect";
|
|
1
2
|
import { PackageManifest } from "@effected/package-json";
|
|
2
3
|
import { CompilerOptions, ResolvedTsconfig } from "@effected/tsconfig-json";
|
|
3
|
-
import { Crypto, Effect, FileSystem, Option, Path, PlatformError, Schema } from "effect";
|
|
4
4
|
import { GitHubRelease } from "@effected/github";
|
|
5
5
|
import { NpmRegistry, PackageTarball, RegistryTarget } from "@effected/npm";
|
|
6
6
|
import { Cache } from "@effected/store";
|
|
7
7
|
import { AppDirs } from "@effected/xdg";
|
|
8
8
|
import { JsoncCanonicalizeError } from "@effected/jsonc";
|
|
9
|
+
//#region ../manifest/dist/dev/pkg/index.d.ts
|
|
9
10
|
//#region src/BundleManifest.d.ts
|
|
10
11
|
/**
|
|
11
12
|
* The registry protocol families this reader knows how to do more than link
|
|
@@ -266,14 +267,83 @@ declare class BundleManifestError extends BundleManifestError_base {
|
|
|
266
267
|
* @public
|
|
267
268
|
*/
|
|
268
269
|
declare function decodeBundleManifest(input: unknown, path?: string): Effect.Effect<BundleManifest, BundleManifestError>;
|
|
269
|
-
|
|
270
|
-
|
|
270
|
+
/**
|
|
271
|
+
* The manifest spec version this package reads and writes.
|
|
272
|
+
*
|
|
273
|
+
* @public
|
|
274
|
+
*/
|
|
275
|
+
declare const MANIFEST_SPEC: 1;
|
|
271
276
|
/**
|
|
272
277
|
* The sidecar manifest's file name inside a bundle folder.
|
|
273
278
|
*
|
|
274
279
|
* @public
|
|
275
280
|
*/
|
|
276
281
|
declare const TSDOCTOR_MANIFEST_FILENAME = "tsdoctor.json";
|
|
282
|
+
/**
|
|
283
|
+
* Encode a {@link (BundleManifest:type)} into the JSON-ready value a writer
|
|
284
|
+
* serializes as `tsdoctor.json`.
|
|
285
|
+
*
|
|
286
|
+
* @remarks
|
|
287
|
+
* The writer's boundary. Going through the schema rather than
|
|
288
|
+
* `JSON.stringify` means an emitted file is by construction what
|
|
289
|
+
* {@link decodeBundleManifest} accepts.
|
|
290
|
+
*
|
|
291
|
+
* @public
|
|
292
|
+
*/
|
|
293
|
+
declare function encodeBundleManifest(manifest: BundleManifest): Effect.Effect<unknown, BundleManifestError>;
|
|
294
|
+
//#endregion
|
|
295
|
+
//#region src/ManifestSource.d.ts
|
|
296
|
+
/**
|
|
297
|
+
* The shape an author checks in as a `tsdoctor.json` SOURCE file, at a
|
|
298
|
+
* package root (the leaf tier) or a workspace root (the project tier).
|
|
299
|
+
*
|
|
300
|
+
* @remarks
|
|
301
|
+
* `BundleManifest` minus `spec` and `project`: a source file never declares
|
|
302
|
+
* its own spec version, and it never declares its inherited tier — the
|
|
303
|
+
* bundler supplies both when it flattens the hierarchy at emit time. Decoded
|
|
304
|
+
* only by writers; readers never see this shape.
|
|
305
|
+
*
|
|
306
|
+
* @public
|
|
307
|
+
*/
|
|
308
|
+
declare const ManifestSource: Schema.Struct<{
|
|
309
|
+
readonly name: Schema.optionalKey<Schema.String>;
|
|
310
|
+
readonly tagline: Schema.optionalKey<Schema.String>;
|
|
311
|
+
readonly description: Schema.optionalKey<Schema.String>;
|
|
312
|
+
readonly openGraph: Schema.optionalKey<Schema.Struct<{
|
|
313
|
+
readonly images: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
314
|
+
readonly path: Schema.optionalKey<Schema.String>;
|
|
315
|
+
readonly url: Schema.optionalKey<Schema.String>;
|
|
316
|
+
readonly type: Schema.optionalKey<Schema.String>;
|
|
317
|
+
readonly width: Schema.optionalKey<Schema.Int>;
|
|
318
|
+
readonly height: Schema.optionalKey<Schema.Int>;
|
|
319
|
+
readonly alt: Schema.optionalKey<Schema.String>;
|
|
320
|
+
}>>>;
|
|
321
|
+
readonly themeColor: Schema.optionalKey<Schema.String>;
|
|
322
|
+
}>>;
|
|
323
|
+
readonly sbom: Schema.optionalKey<Schema.Struct<{
|
|
324
|
+
readonly path: Schema.String;
|
|
325
|
+
readonly format: Schema.optionalKey<Schema.String>;
|
|
326
|
+
}>>;
|
|
327
|
+
readonly registries: Schema.optionalKey<Schema.$Array<Schema.Struct<{
|
|
328
|
+
readonly type: Schema.String;
|
|
329
|
+
readonly name: Schema.String;
|
|
330
|
+
readonly url: Schema.String;
|
|
331
|
+
}>>>;
|
|
332
|
+
}>;
|
|
333
|
+
/**
|
|
334
|
+
* The decoded type of {@link (ManifestSource:variable)}.
|
|
335
|
+
*
|
|
336
|
+
* @public
|
|
337
|
+
*/
|
|
338
|
+
type ManifestSource = typeof ManifestSource.Type;
|
|
339
|
+
/**
|
|
340
|
+
* Decode an unknown value into a {@link (ManifestSource:type)}.
|
|
341
|
+
*
|
|
342
|
+
* @public
|
|
343
|
+
*/
|
|
344
|
+
declare function decodeManifestSource(input: unknown, path?: string): Effect.Effect<ManifestSource, BundleManifestError>;
|
|
345
|
+
//#endregion
|
|
346
|
+
//#region src/Bundle.d.ts
|
|
277
347
|
/**
|
|
278
348
|
* The subset of a `<name>.api.json` model this package reads: the package
|
|
279
349
|
* name from the model's own metadata.
|
|
@@ -885,5 +955,5 @@ declare function hashLayerText(text: string): Effect.Effect<string, PlatformErro
|
|
|
885
955
|
*/
|
|
886
956
|
declare function fingerprintResolvedBundle(resolved: ResolvedBundle): Effect.Effect<Readonly<Record<string, string>>, PlatformError.PlatformError, Crypto.Crypto>;
|
|
887
957
|
//#endregion
|
|
888
|
-
export { type ApiModelInfo, type Bundle, type BundleDescriptor, BundleDiscoveryError, BundleFetchError, BundleLayerError, BundleManifest, BundleManifestError, type BundleOverrides, type DiscoverBundleOptions, type DiscoverBundlesOptions, type FetchGitHubReleaseBundleOptions, type FetchNpmBundleOptions, KNOWN_REGISTRY_TYPES, type KnownRegistryType, OpenGraphConfig, OpenGraphImage, PlatformOverrides, ProjectIdentity, type ProvenanceSource, type Provenanced, RegistryRef, type ResolveBundleInput, type ResolvedBundle, type ResolvedOpenGraph, type ResolvedOpenGraphImage, SbomRef, TSDOCTOR_MANIFEST_FILENAME, decodeBundleManifest, decodePlatformOverrides, discoverBundle, discoverBundles, fetchGitHubReleaseBundle, fetchNpmBundle, fingerprintResolvedBundle, hashJsonValue, hashLayerText, hashText, isKnownRegistryType, loadBundle, loadBundles, normalizeText, readApiModelInfo, readBundle, resolveBundle, resolveBundleFrom };
|
|
958
|
+
export { type ApiModelInfo, type Bundle, type BundleDescriptor, BundleDiscoveryError, BundleFetchError, BundleLayerError, BundleManifest, BundleManifestError, type BundleOverrides, type DiscoverBundleOptions, type DiscoverBundlesOptions, type FetchGitHubReleaseBundleOptions, type FetchNpmBundleOptions, KNOWN_REGISTRY_TYPES, type KnownRegistryType, MANIFEST_SPEC, ManifestSource, OpenGraphConfig, OpenGraphImage, PlatformOverrides, ProjectIdentity, type ProvenanceSource, type Provenanced, RegistryRef, type ResolveBundleInput, type ResolvedBundle, type ResolvedOpenGraph, type ResolvedOpenGraphImage, SbomRef, TSDOCTOR_MANIFEST_FILENAME, decodeBundleManifest, decodeManifestSource, decodePlatformOverrides, discoverBundle, discoverBundles, encodeBundleManifest, fetchGitHubReleaseBundle, fetchNpmBundle, fingerprintResolvedBundle, hashJsonValue, hashLayerText, hashText, isKnownRegistryType, loadBundle, loadBundles, normalizeText, readApiModelInfo, readBundle, resolveBundle, resolveBundleFrom };
|
|
889
959
|
//# sourceMappingURL=index.d.ts.map
|
package/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { BundleLayerError, TSDOCTOR_MANIFEST_FILENAME, readApiModelInfo, readBundle } from "./Bundle.js";
|
|
1
|
+
import { BundleLayerError, readApiModelInfo, readBundle } from "./Bundle.js";
|
|
3
2
|
import { BundleDiscoveryError, discoverBundle, discoverBundles, loadBundle, loadBundles } from "./BundleDiscovery.js";
|
|
4
3
|
import { BundleFetchError, fetchGitHubReleaseBundle, fetchNpmBundle } from "./BundleFetch.js";
|
|
5
4
|
import { fingerprintResolvedBundle, hashJsonValue, hashLayerText, hashText, normalizeText } from "./BundleHash.js";
|
|
6
5
|
import { resolveBundle, resolveBundleFrom } from "./BundleResolver.js";
|
|
7
6
|
import { PlatformOverrides, decodePlatformOverrides } from "./PlatformOverrides.js";
|
|
7
|
+
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
8
|
|
|
9
|
-
export { BundleDiscoveryError, BundleFetchError, BundleLayerError, BundleManifest, BundleManifestError, KNOWN_REGISTRY_TYPES, OpenGraphConfig, OpenGraphImage, PlatformOverrides, ProjectIdentity, RegistryRef, SbomRef, TSDOCTOR_MANIFEST_FILENAME, decodeBundleManifest, decodePlatformOverrides, discoverBundle, discoverBundles, fetchGitHubReleaseBundle, fetchNpmBundle, fingerprintResolvedBundle, hashJsonValue, hashLayerText, hashText, isKnownRegistryType, loadBundle, loadBundles, normalizeText, readApiModelInfo, readBundle, resolveBundle, resolveBundleFrom };
|
|
9
|
+
export { 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, readApiModelInfo, readBundle, resolveBundle, resolveBundleFrom };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tsdoctor/bundle",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.4",
|
|
4
4
|
"private": false,
|
|
5
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.",
|
|
6
6
|
"keywords": [
|
|
@@ -44,10 +44,11 @@
|
|
|
44
44
|
"@effected/jsonc": "^0.8.1",
|
|
45
45
|
"@effected/npm": "^0.12.1",
|
|
46
46
|
"@effected/package-json": "^0.13.0",
|
|
47
|
-
"@effected/store": "^0.
|
|
48
|
-
"@effected/tsconfig-json": "^0.
|
|
47
|
+
"@effected/store": "^0.6.0",
|
|
48
|
+
"@effected/tsconfig-json": "^0.7.0",
|
|
49
49
|
"@effected/walker": "^0.5.0",
|
|
50
50
|
"@effected/xdg": "^0.3.0",
|
|
51
|
+
"@tsdoctor/manifest": "0.1.0",
|
|
51
52
|
"effect": "4.0.0-rc.109"
|
|
52
53
|
},
|
|
53
54
|
"engines": {
|
package/BundleManifest.js
DELETED
|
@@ -1,183 +0,0 @@
|
|
|
1
|
-
import { Effect, Schema } from "effect";
|
|
2
|
-
|
|
3
|
-
//#region src/BundleManifest.ts
|
|
4
|
-
/**
|
|
5
|
-
* The registry protocol families this reader knows how to do more than link
|
|
6
|
-
* to. `"npm"` means an npm-compatible registry — install commands and tarball
|
|
7
|
-
* fetching work against any instance of it — and `"jsr"` the jsr protocol.
|
|
8
|
-
*
|
|
9
|
-
* @remarks
|
|
10
|
-
* The manifest's `type` field is deliberately NOT constrained to these
|
|
11
|
-
* values: unknown future types must degrade to link-only rendering, not
|
|
12
|
-
* reject the manifest. Use {@link isKnownRegistryType} to branch.
|
|
13
|
-
*
|
|
14
|
-
* @public
|
|
15
|
-
*/
|
|
16
|
-
const KNOWN_REGISTRY_TYPES = ["npm", "jsr"];
|
|
17
|
-
/**
|
|
18
|
-
* Whether a registry `type` value is a protocol family this reader
|
|
19
|
-
* recognizes. `false` means the registry entry should degrade to link-only
|
|
20
|
-
* rendering — it is never a validation failure.
|
|
21
|
-
*
|
|
22
|
-
* @public
|
|
23
|
-
*/
|
|
24
|
-
function isKnownRegistryType(type) {
|
|
25
|
-
return KNOWN_REGISTRY_TYPES.includes(type);
|
|
26
|
-
}
|
|
27
|
-
/**
|
|
28
|
-
* One registry the documented package is published to.
|
|
29
|
-
*
|
|
30
|
-
* @remarks
|
|
31
|
-
* `type` is the PROTOCOL FAMILY (`"npm"` covers every npm-compatible
|
|
32
|
-
* registry), `name` the human instance label, `url` the package's page on
|
|
33
|
-
* that instance. Unknown `type` values decode successfully and degrade to
|
|
34
|
-
* link-only rendering (see {@link isKnownRegistryType}).
|
|
35
|
-
*
|
|
36
|
-
* @public
|
|
37
|
-
*/
|
|
38
|
-
const RegistryRef = Schema.Struct({
|
|
39
|
-
/** The protocol family, e.g. `"npm"` or `"jsr"`. Unknown values are accepted. */
|
|
40
|
-
type: Schema.String,
|
|
41
|
-
/** The human instance label, e.g. `"npm"` or `"Savvy Web Registry"`. */
|
|
42
|
-
name: Schema.String,
|
|
43
|
-
/** The package's URL on that registry instance. */
|
|
44
|
-
url: Schema.String
|
|
45
|
-
});
|
|
46
|
-
/**
|
|
47
|
-
* One Open Graph image declared by the manifest.
|
|
48
|
-
*
|
|
49
|
-
* @remarks
|
|
50
|
-
* Exactly ONE of `path` (a bundle-relative asset the consuming platform
|
|
51
|
-
* publishes and resolves to a URL) or `url` (an absolute external URL used
|
|
52
|
-
* verbatim) must be present — the schema enforces the XOR. `type` is a MIME
|
|
53
|
-
* type, inferred from the file extension by the resolver when omitted; `alt`
|
|
54
|
-
* has a documented inference chain (tagline → description →
|
|
55
|
-
* `"<name> API documentation"`).
|
|
56
|
-
*
|
|
57
|
-
* @public
|
|
58
|
-
*/
|
|
59
|
-
const OpenGraphImage = Schema.Struct({
|
|
60
|
-
/** Bundle-relative asset path. Mutually exclusive with `url`. */
|
|
61
|
-
path: Schema.optionalKey(Schema.String),
|
|
62
|
-
/** Absolute external URL, used verbatim. Mutually exclusive with `path`. */
|
|
63
|
-
url: Schema.optionalKey(Schema.String),
|
|
64
|
-
/** MIME type; inferred from the extension when omitted. */
|
|
65
|
-
type: Schema.optionalKey(Schema.String),
|
|
66
|
-
/** Pixel width; 1200×630 (1.91:1) is the cross-platform safe default. */
|
|
67
|
-
width: Schema.optionalKey(Schema.Int),
|
|
68
|
-
/** Pixel height. */
|
|
69
|
-
height: Schema.optionalKey(Schema.Int),
|
|
70
|
-
/** Alt text; inferred (tagline → description → fallback) when omitted. */
|
|
71
|
-
alt: Schema.optionalKey(Schema.String)
|
|
72
|
-
}).check(Schema.makeFilter((image) => image.path === void 0 !== (image.url === void 0) ? void 0 : "exactly one of \"path\" or \"url\" must be present", { title: "openGraph image source" }));
|
|
73
|
-
/**
|
|
74
|
-
* The manifest's Open Graph block: the asset-ish pieces only — most OG tags
|
|
75
|
-
* are page-level and derive at render time in the consuming platform.
|
|
76
|
-
*
|
|
77
|
-
* @remarks
|
|
78
|
-
* Multiple images follow OG array semantics: the first declared wins, extras
|
|
79
|
-
* are alternates (e.g. a portrait 1000×1500 variant).
|
|
80
|
-
*
|
|
81
|
-
* @public
|
|
82
|
-
*/
|
|
83
|
-
const OpenGraphConfig = Schema.Struct({
|
|
84
|
-
/** Declared images, first-wins per OG array semantics. */
|
|
85
|
-
images: Schema.optionalKey(Schema.Array(OpenGraphImage)),
|
|
86
|
-
/** Embed accent color (e.g. Discord), a CSS color string. */
|
|
87
|
-
themeColor: Schema.optionalKey(Schema.String)
|
|
88
|
-
});
|
|
89
|
-
/**
|
|
90
|
-
* A pointer to the bundle's SBOM, computed by the bundler at publish and
|
|
91
|
-
* served as a downloadable static asset.
|
|
92
|
-
*
|
|
93
|
-
* @public
|
|
94
|
-
*/
|
|
95
|
-
const SbomRef = Schema.Struct({
|
|
96
|
-
/** Bundle-relative path to the SBOM file. */
|
|
97
|
-
path: Schema.String,
|
|
98
|
-
/** SBOM format label, e.g. `"spdx-json"`. Unknown values are accepted. */
|
|
99
|
-
format: Schema.optionalKey(Schema.String)
|
|
100
|
-
});
|
|
101
|
-
/**
|
|
102
|
-
* The inherited project tier, flattened into the emitted manifest by the
|
|
103
|
-
* bundler (a fetched bundle has no parent directory to walk). Kept nested —
|
|
104
|
-
* structurally distinguishable from the leaf fields — because provenance is
|
|
105
|
-
* load-bearing for override detection.
|
|
106
|
-
*
|
|
107
|
-
* @public
|
|
108
|
-
*/
|
|
109
|
-
const ProjectIdentity = Schema.Struct({
|
|
110
|
-
/** The project display name, e.g. `"Effected"` over leaf `@effected/store`. */
|
|
111
|
-
name: Schema.optionalKey(Schema.String),
|
|
112
|
-
/** The project tagline. */
|
|
113
|
-
tagline: Schema.optionalKey(Schema.String)
|
|
114
|
-
});
|
|
115
|
-
/**
|
|
116
|
-
* The versioned `tsdoctor.json` sidecar manifest — bundle layer 3.
|
|
117
|
-
*
|
|
118
|
-
* @remarks
|
|
119
|
-
* `spec` is the only required field; every other field enriches. Unknown
|
|
120
|
-
* top-level fields are ignored on decode (additive fields are minor spec
|
|
121
|
-
* revisions) and unknown enum-ish values (registry `type`, sbom `format`)
|
|
122
|
-
* degrade gracefully instead of rejecting — an old reader must be able to
|
|
123
|
-
* consume a new bundle.
|
|
124
|
-
*
|
|
125
|
-
* @public
|
|
126
|
-
*/
|
|
127
|
-
const BundleManifest = Schema.Struct({
|
|
128
|
-
/** The integer spec version. This reader understands spec 1. */
|
|
129
|
-
spec: Schema.Literal(1),
|
|
130
|
-
/** Human display name (the npm name is dry; this one is SEO-friendly). */
|
|
131
|
-
name: Schema.optionalKey(Schema.String),
|
|
132
|
-
/** Short tagline. */
|
|
133
|
-
tagline: Schema.optionalKey(Schema.String),
|
|
134
|
-
/** Long description; overrides the package.json description when present. */
|
|
135
|
-
description: Schema.optionalKey(Schema.String),
|
|
136
|
-
/** The inherited project tier, flattened in at emit time. */
|
|
137
|
-
project: Schema.optionalKey(ProjectIdentity),
|
|
138
|
-
/** Open Graph assets. */
|
|
139
|
-
openGraph: Schema.optionalKey(OpenGraphConfig),
|
|
140
|
-
/** SBOM pointer. */
|
|
141
|
-
sbom: Schema.optionalKey(SbomRef),
|
|
142
|
-
/** Registries the package is published to. */
|
|
143
|
-
registries: Schema.optionalKey(Schema.Array(RegistryRef))
|
|
144
|
-
});
|
|
145
|
-
/**
|
|
146
|
-
* Raised when a present `tsdoctor.json` cannot be parsed or does not satisfy
|
|
147
|
-
* the {@link (BundleManifest:variable)} schema.
|
|
148
|
-
*
|
|
149
|
-
* @remarks
|
|
150
|
-
* Absence of the manifest is NEVER this error — layers enrich, never gate,
|
|
151
|
-
* so a missing sidecar is the normal case and reads as `Option.none()`.
|
|
152
|
-
*
|
|
153
|
-
* @public
|
|
154
|
-
*/
|
|
155
|
-
var BundleManifestError = class extends Schema.TaggedError()("BundleManifestError", {
|
|
156
|
-
/** The manifest file path, when the failure is tied to a file on disk. */
|
|
157
|
-
path: Schema.optionalKey(Schema.String),
|
|
158
|
-
/** The underlying failure (JSON syntax or schema decode), preserved structurally. */
|
|
159
|
-
cause: Schema.Defect()
|
|
160
|
-
}) {
|
|
161
|
-
get message() {
|
|
162
|
-
return `Invalid tsdoctor.json manifest${this.path !== void 0 ? ` at ${this.path}` : ""}`;
|
|
163
|
-
}
|
|
164
|
-
};
|
|
165
|
-
/**
|
|
166
|
-
* Decode an unknown value into a {@link (BundleManifest:type)}.
|
|
167
|
-
*
|
|
168
|
-
* @remarks
|
|
169
|
-
* The typed boundary for manifest input that has already been parsed from
|
|
170
|
-
* JSON (plugin options, fetched payloads). File-based reading lives in
|
|
171
|
-
* `readBundle`, which routes through this after parsing.
|
|
172
|
-
*
|
|
173
|
-
* @public
|
|
174
|
-
*/
|
|
175
|
-
function decodeBundleManifest(input, path) {
|
|
176
|
-
return Schema.decodeUnknownEffect(BundleManifest)(input).pipe(Effect.mapError((cause) => new BundleManifestError({
|
|
177
|
-
...path !== void 0 ? { path } : {},
|
|
178
|
-
cause
|
|
179
|
-
})));
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
//#endregion
|
|
183
|
-
export { BundleManifest, BundleManifestError, KNOWN_REGISTRY_TYPES, OpenGraphConfig, OpenGraphImage, ProjectIdentity, RegistryRef, SbomRef, decodeBundleManifest, isKnownRegistryType };
|