@taprootio/docs-artifact 1.0.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.
- package/LICENSE +13 -0
- package/README.md +362 -0
- package/bin/taproot-docs-conformance.js +20 -0
- package/bin/taproot-docs-validate.js +17 -0
- package/conformance.d.ts +11 -0
- package/fixtures/README.md +24 -0
- package/fixtures/conformance.json +1630 -0
- package/fixtures/invalid/duplicate-json-key.json +1 -0
- package/fixtures/invalid/hash-drift/taproot-docs/fragments/welcome.html +1 -0
- package/fixtures/invalid/size-drift/taproot-docs/fragments/welcome.html +1 -0
- package/fixtures/invalid/unsafe-markup/taproot-docs/fragments/welcome.html +1 -0
- package/fixtures/valid/complete/taproot-docs/assets/pixel.png.base64 +1 -0
- package/fixtures/valid/complete/taproot-docs/fragments/button.en-us.html +1 -0
- package/fixtures/valid/complete/taproot-docs/fragments/button.fr-fr.html +1 -0
- package/fixtures/valid/complete/taproot-docs/fragments/getting-started.en-us.html +3 -0
- package/fixtures/valid/complete/taproot-docs/fragments/getting-started.fr-fr.html +3 -0
- package/fixtures/valid/complete/taproot-docs-manifest.json +231 -0
- package/fixtures/valid/minimal/taproot-docs/fragments/welcome.html +1 -0
- package/fixtures/valid/minimal/taproot-docs-manifest.json +80 -0
- package/index.d.ts +204 -0
- package/node.d.ts +6 -0
- package/package.json +54 -0
- package/schema/taproot-docs-manifest.schema.json +487 -0
- package/src/artifact-validator.js +870 -0
- package/src/binary.js +67 -0
- package/src/conformance.js +578 -0
- package/src/constants.js +104 -0
- package/src/errors.js +139 -0
- package/src/index.js +18 -0
- package/src/json.js +516 -0
- package/src/manifest-validator.js +650 -0
- package/src/markup.js +578 -0
- package/src/node-internal.js +4 -0
- package/src/node.js +513 -0
- package/src/path.js +103 -0
- package/src/text.js +30 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"schemaVersion":1,"schemaVersion":1}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p>Welcome to the documentatioN.</p>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p>Welcome to the documentation.</p>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<script>alert(1)</script>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAQAAAC1HAwCAAAAC0lEQVR42mNk+A8AAQUBAScY42YAAAAASUVORK5CYII=
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p>Use <code data-language="html"><esp-button></code>.</p>
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p>Utilisez <code data-language="html"><esp-button></code>.</p>
|
|
@@ -0,0 +1,231 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"defaultLocale": "en-US",
|
|
4
|
+
"source": {
|
|
5
|
+
"provider": "github",
|
|
6
|
+
"repositoryId": "R_fixture_complete",
|
|
7
|
+
"repository": "taprootio/docs-fixture",
|
|
8
|
+
"repositoryUrl": "https://github.com/taprootio/docs-fixture",
|
|
9
|
+
"revision": "0123456789abcdef0123456789abcdef01234567",
|
|
10
|
+
"ref": "refs/heads/main"
|
|
11
|
+
},
|
|
12
|
+
"build": {
|
|
13
|
+
"producer": "@taprootio/wtfm",
|
|
14
|
+
"producerVersion": "1.0.0",
|
|
15
|
+
"configurationSha256": "sha256:1111111111111111111111111111111111111111111111111111111111111111",
|
|
16
|
+
"sourceDateEpoch": 1767225600
|
|
17
|
+
},
|
|
18
|
+
"capabilities": {
|
|
19
|
+
"required": [
|
|
20
|
+
"taproot.docs.fragments.html.v1"
|
|
21
|
+
],
|
|
22
|
+
"optional": [
|
|
23
|
+
"taproot.docs.future-annotation.v1"
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
"locales": [
|
|
27
|
+
{
|
|
28
|
+
"tag": "en-US",
|
|
29
|
+
"label": "English"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"tag": "fr-FR",
|
|
33
|
+
"label": "Français"
|
|
34
|
+
}
|
|
35
|
+
],
|
|
36
|
+
"resources": [
|
|
37
|
+
{
|
|
38
|
+
"key": "guide:getting-started",
|
|
39
|
+
"semantic": {
|
|
40
|
+
"kind": "guide",
|
|
41
|
+
"audiences": [
|
|
42
|
+
"developer",
|
|
43
|
+
"user"
|
|
44
|
+
],
|
|
45
|
+
"tags": [
|
|
46
|
+
"installation",
|
|
47
|
+
"quickstart"
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
"variants": [
|
|
51
|
+
{
|
|
52
|
+
"locale": "en-US",
|
|
53
|
+
"route": "/guides/getting-started/",
|
|
54
|
+
"title": "Getting started",
|
|
55
|
+
"description": "Install the library and render your first button.",
|
|
56
|
+
"headings": [
|
|
57
|
+
{
|
|
58
|
+
"id": "install",
|
|
59
|
+
"text": "Install",
|
|
60
|
+
"level": 2
|
|
61
|
+
}
|
|
62
|
+
],
|
|
63
|
+
"source": {
|
|
64
|
+
"path": "guides/getting-started.md",
|
|
65
|
+
"url": "https://github.com/taprootio/docs-fixture/blob/0123456789abcdef0123456789abcdef01234567/guides/getting-started.md"
|
|
66
|
+
},
|
|
67
|
+
"fragments": [
|
|
68
|
+
{
|
|
69
|
+
"key": "body",
|
|
70
|
+
"role": "body",
|
|
71
|
+
"path": "taproot-docs/fragments/getting-started.en-us.html",
|
|
72
|
+
"mediaType": "text/html; charset=utf-8",
|
|
73
|
+
"bytes": 194,
|
|
74
|
+
"sha256": "sha256:bc6882d8168672285d292fc40a289a4daa0f4fb3204409dd0d8665f6fef96d1c"
|
|
75
|
+
}
|
|
76
|
+
]
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
"locale": "fr-FR",
|
|
80
|
+
"route": "/fr/guides/demarrage/",
|
|
81
|
+
"title": "Bien démarrer",
|
|
82
|
+
"description": "Installez la bibliothèque et affichez votre premier bouton.",
|
|
83
|
+
"headings": [
|
|
84
|
+
{
|
|
85
|
+
"id": "installer",
|
|
86
|
+
"text": "Installer",
|
|
87
|
+
"level": 2
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
"source": {
|
|
91
|
+
"path": "guides/fr/getting-started.md",
|
|
92
|
+
"url": "https://github.com/taprootio/docs-fixture/blob/0123456789abcdef0123456789abcdef01234567/guides/fr/getting-started.md"
|
|
93
|
+
},
|
|
94
|
+
"fragments": [
|
|
95
|
+
{
|
|
96
|
+
"key": "body",
|
|
97
|
+
"role": "body",
|
|
98
|
+
"path": "taproot-docs/fragments/getting-started.fr-fr.html",
|
|
99
|
+
"mediaType": "text/html; charset=utf-8",
|
|
100
|
+
"bytes": 200,
|
|
101
|
+
"sha256": "sha256:0485393e88fb00ab1310430a15e968f96459696fd0d6363ed34e25e1df3430ea"
|
|
102
|
+
}
|
|
103
|
+
]
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
},
|
|
107
|
+
{
|
|
108
|
+
"key": "reference:button",
|
|
109
|
+
"semantic": {
|
|
110
|
+
"kind": "reference",
|
|
111
|
+
"audiences": [
|
|
112
|
+
"developer"
|
|
113
|
+
],
|
|
114
|
+
"tags": [
|
|
115
|
+
"components"
|
|
116
|
+
]
|
|
117
|
+
},
|
|
118
|
+
"variants": [
|
|
119
|
+
{
|
|
120
|
+
"locale": "en-US",
|
|
121
|
+
"route": "/components/button/",
|
|
122
|
+
"title": "Button",
|
|
123
|
+
"description": "Button component reference.",
|
|
124
|
+
"headings": [],
|
|
125
|
+
"source": {
|
|
126
|
+
"path": "src/button.ts",
|
|
127
|
+
"url": "https://github.com/taprootio/docs-fixture/blob/0123456789abcdef0123456789abcdef01234567/src/button.ts"
|
|
128
|
+
},
|
|
129
|
+
"fragments": [
|
|
130
|
+
{
|
|
131
|
+
"key": "body",
|
|
132
|
+
"role": "body",
|
|
133
|
+
"path": "taproot-docs/fragments/button.en-us.html",
|
|
134
|
+
"mediaType": "text/html; charset=utf-8",
|
|
135
|
+
"bytes": 65,
|
|
136
|
+
"sha256": "sha256:dfab2576f38131e44b1c583aa1ffca0624d60210e8d2d4fbf481f0cbf24e6625"
|
|
137
|
+
}
|
|
138
|
+
]
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
"locale": "fr-FR",
|
|
142
|
+
"route": "/fr/composants/bouton/",
|
|
143
|
+
"title": "Bouton",
|
|
144
|
+
"description": "Référence du composant bouton.",
|
|
145
|
+
"headings": [],
|
|
146
|
+
"source": {
|
|
147
|
+
"path": "src/button.ts",
|
|
148
|
+
"url": "https://github.com/taprootio/docs-fixture/blob/0123456789abcdef0123456789abcdef01234567/src/button.ts"
|
|
149
|
+
},
|
|
150
|
+
"fragments": [
|
|
151
|
+
{
|
|
152
|
+
"key": "body",
|
|
153
|
+
"role": "body",
|
|
154
|
+
"path": "taproot-docs/fragments/button.fr-fr.html",
|
|
155
|
+
"mediaType": "text/html; charset=utf-8",
|
|
156
|
+
"bytes": 70,
|
|
157
|
+
"sha256": "sha256:1d275771bcb0e927d04d5fe97d546b4f3e99b077166ec6328ccec1d91881d459"
|
|
158
|
+
}
|
|
159
|
+
]
|
|
160
|
+
}
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
],
|
|
164
|
+
"navigation": [
|
|
165
|
+
{
|
|
166
|
+
"locale": "en-US",
|
|
167
|
+
"items": [
|
|
168
|
+
{
|
|
169
|
+
"label": "Guides",
|
|
170
|
+
"children": [
|
|
171
|
+
{
|
|
172
|
+
"label": "Getting started",
|
|
173
|
+
"resourceKey": "guide:getting-started"
|
|
174
|
+
}
|
|
175
|
+
]
|
|
176
|
+
},
|
|
177
|
+
{
|
|
178
|
+
"label": "Reference",
|
|
179
|
+
"children": [
|
|
180
|
+
{
|
|
181
|
+
"label": "Button",
|
|
182
|
+
"resourceKey": "reference:button"
|
|
183
|
+
}
|
|
184
|
+
]
|
|
185
|
+
}
|
|
186
|
+
]
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
"locale": "fr-FR",
|
|
190
|
+
"items": [
|
|
191
|
+
{
|
|
192
|
+
"label": "Guides",
|
|
193
|
+
"children": [
|
|
194
|
+
{
|
|
195
|
+
"label": "Bien démarrer",
|
|
196
|
+
"resourceKey": "guide:getting-started"
|
|
197
|
+
}
|
|
198
|
+
]
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
"label": "Référence",
|
|
202
|
+
"children": [
|
|
203
|
+
{
|
|
204
|
+
"label": "Bouton",
|
|
205
|
+
"resourceKey": "reference:button"
|
|
206
|
+
}
|
|
207
|
+
]
|
|
208
|
+
}
|
|
209
|
+
]
|
|
210
|
+
}
|
|
211
|
+
],
|
|
212
|
+
"redirects": [
|
|
213
|
+
{
|
|
214
|
+
"from": "/start/",
|
|
215
|
+
"toResourceKey": "guide:getting-started",
|
|
216
|
+
"locale": "en-US",
|
|
217
|
+
"status": 308
|
|
218
|
+
}
|
|
219
|
+
],
|
|
220
|
+
"assets": [
|
|
221
|
+
{
|
|
222
|
+
"key": "image:pixel",
|
|
223
|
+
"path": "taproot-docs/assets/pixel.png",
|
|
224
|
+
"mediaType": "image/png",
|
|
225
|
+
"bytes": 68,
|
|
226
|
+
"sha256": "sha256:431ced6916a2a21a156e38701afe55bbd7f88969fbbfc56d7fe099d47f265460",
|
|
227
|
+
"width": 1,
|
|
228
|
+
"height": 1
|
|
229
|
+
}
|
|
230
|
+
]
|
|
231
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
<p>Welcome to the documentation.</p>
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"defaultLocale": "en-US",
|
|
4
|
+
"source": {
|
|
5
|
+
"provider": "github",
|
|
6
|
+
"repositoryId": "R_fixture_minimal",
|
|
7
|
+
"repository": "taprootio/docs-fixture",
|
|
8
|
+
"repositoryUrl": "https://github.com/taprootio/docs-fixture",
|
|
9
|
+
"revision": "0123456789abcdef0123456789abcdef01234567",
|
|
10
|
+
"ref": "refs/heads/main"
|
|
11
|
+
},
|
|
12
|
+
"build": {
|
|
13
|
+
"producer": "@taprootio/wtfm",
|
|
14
|
+
"producerVersion": "1.0.0",
|
|
15
|
+
"configurationSha256": "sha256:0000000000000000000000000000000000000000000000000000000000000000",
|
|
16
|
+
"sourceDateEpoch": 1767225600
|
|
17
|
+
},
|
|
18
|
+
"capabilities": {
|
|
19
|
+
"required": [
|
|
20
|
+
"taproot.docs.fragments.html.v1"
|
|
21
|
+
],
|
|
22
|
+
"optional": []
|
|
23
|
+
},
|
|
24
|
+
"locales": [
|
|
25
|
+
{
|
|
26
|
+
"tag": "en-US",
|
|
27
|
+
"label": "English"
|
|
28
|
+
}
|
|
29
|
+
],
|
|
30
|
+
"resources": [
|
|
31
|
+
{
|
|
32
|
+
"key": "guide:welcome",
|
|
33
|
+
"semantic": {
|
|
34
|
+
"kind": "guide",
|
|
35
|
+
"audiences": [
|
|
36
|
+
"user"
|
|
37
|
+
],
|
|
38
|
+
"tags": []
|
|
39
|
+
},
|
|
40
|
+
"variants": [
|
|
41
|
+
{
|
|
42
|
+
"locale": "en-US",
|
|
43
|
+
"route": "/welcome/",
|
|
44
|
+
"title": "Welcome",
|
|
45
|
+
"description": "A minimal conforming documentation resource.",
|
|
46
|
+
"headings": [],
|
|
47
|
+
"source": {
|
|
48
|
+
"path": "guides/welcome.md",
|
|
49
|
+
"url": "https://github.com/taprootio/docs-fixture/blob/0123456789abcdef0123456789abcdef01234567/guides/welcome.md",
|
|
50
|
+
"startLine": 1,
|
|
51
|
+
"endLine": 3
|
|
52
|
+
},
|
|
53
|
+
"fragments": [
|
|
54
|
+
{
|
|
55
|
+
"key": "body",
|
|
56
|
+
"role": "body",
|
|
57
|
+
"path": "taproot-docs/fragments/welcome.html",
|
|
58
|
+
"mediaType": "text/html; charset=utf-8",
|
|
59
|
+
"bytes": 37,
|
|
60
|
+
"sha256": "sha256:13977afe13c21fc2fd5962f7155c0df0ca57bb4550f5fd08ec982a46e28709a1"
|
|
61
|
+
}
|
|
62
|
+
]
|
|
63
|
+
}
|
|
64
|
+
]
|
|
65
|
+
}
|
|
66
|
+
],
|
|
67
|
+
"navigation": [
|
|
68
|
+
{
|
|
69
|
+
"locale": "en-US",
|
|
70
|
+
"items": [
|
|
71
|
+
{
|
|
72
|
+
"label": "Welcome",
|
|
73
|
+
"resourceKey": "guide:welcome"
|
|
74
|
+
}
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
],
|
|
78
|
+
"redirects": [],
|
|
79
|
+
"assets": []
|
|
80
|
+
}
|
package/index.d.ts
ADDED
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
export interface DocsArtifactSource {
|
|
2
|
+
provider: "github";
|
|
3
|
+
repositoryId: string;
|
|
4
|
+
repository: string;
|
|
5
|
+
repositoryUrl: string;
|
|
6
|
+
revision: string;
|
|
7
|
+
ref: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface DocsArtifactBuild {
|
|
11
|
+
producer: string;
|
|
12
|
+
producerVersion: string;
|
|
13
|
+
configurationSha256: string;
|
|
14
|
+
sourceDateEpoch: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface DocsArtifactCapabilities {
|
|
18
|
+
required: string[];
|
|
19
|
+
optional: string[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export interface DocsLocale {
|
|
23
|
+
tag: string;
|
|
24
|
+
label: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export type DocsResourceKind = "api" | "changelog" | "concept" | "guide" | "other" | "reference";
|
|
28
|
+
export type DocsAudience = "administrator" | "developer" | "operator" | "user";
|
|
29
|
+
|
|
30
|
+
export interface DocsSemanticMetadata {
|
|
31
|
+
kind: DocsResourceKind;
|
|
32
|
+
audiences: DocsAudience[];
|
|
33
|
+
tags: string[];
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
export interface DocsHeading {
|
|
37
|
+
id: string;
|
|
38
|
+
text: string;
|
|
39
|
+
level: 2 | 3 | 4 | 5 | 6;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface DocsSourceLocation {
|
|
43
|
+
path: string;
|
|
44
|
+
url: string;
|
|
45
|
+
startLine?: number;
|
|
46
|
+
endLine?: number;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export type DocsFragmentRole = "aside" | "body" | "example";
|
|
50
|
+
|
|
51
|
+
export interface DocsFragment {
|
|
52
|
+
key: string;
|
|
53
|
+
role: DocsFragmentRole;
|
|
54
|
+
path: string;
|
|
55
|
+
mediaType: "text/html; charset=utf-8";
|
|
56
|
+
bytes: number;
|
|
57
|
+
sha256: string;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
export interface DocsResourceVariant {
|
|
61
|
+
locale: string;
|
|
62
|
+
route: string;
|
|
63
|
+
title: string;
|
|
64
|
+
description: string;
|
|
65
|
+
headings: DocsHeading[];
|
|
66
|
+
source: DocsSourceLocation;
|
|
67
|
+
fragments: DocsFragment[];
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export interface DocsResource {
|
|
71
|
+
key: string;
|
|
72
|
+
semantic: DocsSemanticMetadata;
|
|
73
|
+
variants: DocsResourceVariant[];
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export interface DocsNavigationNode {
|
|
77
|
+
label: string;
|
|
78
|
+
resourceKey?: string;
|
|
79
|
+
children?: DocsNavigationNode[];
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
export interface DocsNavigation {
|
|
83
|
+
locale: string;
|
|
84
|
+
items: DocsNavigationNode[];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export interface DocsRedirect {
|
|
88
|
+
from: string;
|
|
89
|
+
toResourceKey: string;
|
|
90
|
+
locale: string;
|
|
91
|
+
status: 301 | 308;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
export type DocsAssetMediaType = "image/gif" | "image/jpeg" | "image/png" | "image/webp";
|
|
95
|
+
|
|
96
|
+
export interface DocsAsset {
|
|
97
|
+
key: string;
|
|
98
|
+
path: string;
|
|
99
|
+
mediaType: DocsAssetMediaType;
|
|
100
|
+
bytes: number;
|
|
101
|
+
sha256: string;
|
|
102
|
+
width: number;
|
|
103
|
+
height: number;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export interface DocsArtifactManifest {
|
|
107
|
+
schemaVersion: 1;
|
|
108
|
+
defaultLocale: string;
|
|
109
|
+
source: DocsArtifactSource;
|
|
110
|
+
build: DocsArtifactBuild;
|
|
111
|
+
capabilities: DocsArtifactCapabilities;
|
|
112
|
+
locales: DocsLocale[];
|
|
113
|
+
resources: DocsResource[];
|
|
114
|
+
navigation: DocsNavigation[];
|
|
115
|
+
redirects: DocsRedirect[];
|
|
116
|
+
assets: DocsAsset[];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export interface DocsArtifactValidationErrorItem {
|
|
120
|
+
code: string;
|
|
121
|
+
path: string;
|
|
122
|
+
message: string;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export type ValidationResult<T> =
|
|
126
|
+
| { ok: true; value: T }
|
|
127
|
+
| { ok: false; errors: DocsArtifactValidationErrorItem[] };
|
|
128
|
+
|
|
129
|
+
export interface ValidationOptions {
|
|
130
|
+
/**
|
|
131
|
+
* At most LIMITS.supportedCapabilities canonical resource-key strings, each
|
|
132
|
+
* no longer than LIMITS.resourceKey.
|
|
133
|
+
*/
|
|
134
|
+
supportedCapabilities?: Iterable<string> & object;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export type ManifestInput = DocsArtifactManifest | string | Uint8Array | ArrayBuffer;
|
|
138
|
+
export type ArtifactFileContent = string | Uint8Array | ArrayBuffer;
|
|
139
|
+
|
|
140
|
+
export interface ArtifactFileEntry {
|
|
141
|
+
path: string;
|
|
142
|
+
content: ArtifactFileContent;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
export interface ValidatedArtifact {
|
|
146
|
+
manifest: DocsArtifactManifest;
|
|
147
|
+
fileCount: number;
|
|
148
|
+
totalBytes: number;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
export class DocsArtifactValidationError extends Error {
|
|
152
|
+
readonly errors: DocsArtifactValidationErrorItem[];
|
|
153
|
+
constructor(errors: DocsArtifactValidationErrorItem[]);
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
export interface NormalizedPath {
|
|
157
|
+
ok: true;
|
|
158
|
+
value: string;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
export interface InvalidPath {
|
|
162
|
+
ok: false;
|
|
163
|
+
code: string;
|
|
164
|
+
message: string;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export interface DocsArtifactLimits {
|
|
168
|
+
readonly [name: string]: number;
|
|
169
|
+
readonly decodedPixels: number;
|
|
170
|
+
readonly decodedAnimationPixels: number;
|
|
171
|
+
readonly animationFrames: number;
|
|
172
|
+
readonly supportedCapabilities: number;
|
|
173
|
+
readonly resourceKey: number;
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
export const MANIFEST_FILE_NAME: "taproot-docs-manifest.json";
|
|
177
|
+
export const SCHEMA_VERSION: 1;
|
|
178
|
+
export const HTML_FRAGMENT_CAPABILITY: "taproot.docs.fragments.html.v1";
|
|
179
|
+
export const SUPPORTED_CAPABILITIES: readonly string[];
|
|
180
|
+
export const ASSET_MEDIA_TYPES: readonly DocsAssetMediaType[];
|
|
181
|
+
export const AUDIENCES: readonly DocsAudience[];
|
|
182
|
+
export const FRAGMENT_MEDIA_TYPE: "text/html; charset=utf-8";
|
|
183
|
+
export const FRAGMENT_ROLES: readonly DocsFragmentRole[];
|
|
184
|
+
export const RESOURCE_KINDS: readonly DocsResourceKind[];
|
|
185
|
+
export const RESERVED_ROUTE_PREFIXES: readonly string[];
|
|
186
|
+
export const RESERVED_ROUTES: readonly string[];
|
|
187
|
+
export const LIMITS: Readonly<DocsArtifactLimits>;
|
|
188
|
+
|
|
189
|
+
export function normalizeArtifactPath(value: unknown): NormalizedPath | InvalidPath;
|
|
190
|
+
export function normalizeSourcePath(value: unknown): NormalizedPath | InvalidPath;
|
|
191
|
+
export function normalizeRoute(value: unknown): NormalizedPath | InvalidPath;
|
|
192
|
+
export function validateManifest(input: unknown, options?: ValidationOptions): ValidationResult<DocsArtifactManifest>;
|
|
193
|
+
export function assertValidManifest(input: unknown, options?: ValidationOptions): DocsArtifactManifest;
|
|
194
|
+
export function serializeManifest(input: unknown, options?: ValidationOptions): string;
|
|
195
|
+
export function validateArtifact(
|
|
196
|
+
manifest: unknown,
|
|
197
|
+
files: Iterable<ArtifactFileEntry>,
|
|
198
|
+
options?: ValidationOptions,
|
|
199
|
+
): Promise<ValidationResult<ValidatedArtifact>>;
|
|
200
|
+
export function assertValidArtifact(
|
|
201
|
+
manifest: unknown,
|
|
202
|
+
files: Iterable<ArtifactFileEntry>,
|
|
203
|
+
options?: ValidationOptions,
|
|
204
|
+
): Promise<ValidatedArtifact>;
|
package/node.d.ts
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@taprootio/docs-artifact",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Canonical Taproot Docs artifact schema, validator, and conformance fixtures",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"license": "ISC",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "https://github.com/taprootio/trunk.git",
|
|
10
|
+
"directory": "packages/docs-artifact"
|
|
11
|
+
},
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=22"
|
|
14
|
+
},
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": "./index.d.ts",
|
|
18
|
+
"import": "./src/index.js"
|
|
19
|
+
},
|
|
20
|
+
"./node": {
|
|
21
|
+
"types": "./node.d.ts",
|
|
22
|
+
"import": "./src/node.js"
|
|
23
|
+
},
|
|
24
|
+
"./conformance": {
|
|
25
|
+
"types": "./conformance.d.ts",
|
|
26
|
+
"import": "./src/conformance.js"
|
|
27
|
+
},
|
|
28
|
+
"./schema": "./schema/taproot-docs-manifest.schema.json",
|
|
29
|
+
"./fixtures/conformance.json": "./fixtures/conformance.json"
|
|
30
|
+
},
|
|
31
|
+
"bin": {
|
|
32
|
+
"taproot-docs-validate": "./bin/taproot-docs-validate.js"
|
|
33
|
+
},
|
|
34
|
+
"files": [
|
|
35
|
+
"bin/",
|
|
36
|
+
"fixtures/",
|
|
37
|
+
"schema/",
|
|
38
|
+
"src/",
|
|
39
|
+
"LICENSE",
|
|
40
|
+
"README.md",
|
|
41
|
+
"index.d.ts",
|
|
42
|
+
"node.d.ts",
|
|
43
|
+
"conformance.d.ts"
|
|
44
|
+
],
|
|
45
|
+
"scripts": {
|
|
46
|
+
"test": "node --test",
|
|
47
|
+
"conformance": "node ./bin/taproot-docs-conformance.js",
|
|
48
|
+
"prepack": "npm test && npm run conformance"
|
|
49
|
+
},
|
|
50
|
+
"publishConfig": {
|
|
51
|
+
"access": "public",
|
|
52
|
+
"provenance": true
|
|
53
|
+
}
|
|
54
|
+
}
|