@openpkg-ts/spec 0.8.0 → 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/dist/index.d.ts +67 -1
- package/dist/index.js +129 -1
- package/package.json +1 -1
- package/schemas/v0.3.0/openpkg.schema.json +129 -1
package/dist/index.d.ts
CHANGED
|
@@ -256,6 +256,70 @@ type OpenPkgMeta = {
|
|
|
256
256
|
repository?: string;
|
|
257
257
|
ecosystem?: string;
|
|
258
258
|
};
|
|
259
|
+
/**
|
|
260
|
+
* Method used to detect the entry point for analysis.
|
|
261
|
+
*/
|
|
262
|
+
type EntryPointDetectionMethod = "types" | "exports" | "main" | "module" | "fallback" | "explicit" | "llm";
|
|
263
|
+
/**
|
|
264
|
+
* Severity level for issues encountered during spec generation.
|
|
265
|
+
*/
|
|
266
|
+
type GenerationIssueSeverity = "error" | "warning" | "info";
|
|
267
|
+
/**
|
|
268
|
+
* An issue encountered during spec generation.
|
|
269
|
+
*/
|
|
270
|
+
type GenerationIssue = {
|
|
271
|
+
/** Machine-readable issue code */
|
|
272
|
+
code: string;
|
|
273
|
+
/** Human-readable issue message */
|
|
274
|
+
message: string;
|
|
275
|
+
/** Severity level */
|
|
276
|
+
severity: GenerationIssueSeverity;
|
|
277
|
+
/** Suggested resolution */
|
|
278
|
+
suggestion?: string;
|
|
279
|
+
};
|
|
280
|
+
/**
|
|
281
|
+
* Metadata about how a spec was generated.
|
|
282
|
+
* Provides transparency about the analysis process and any limitations.
|
|
283
|
+
*/
|
|
284
|
+
type SpecGenerationInfo = {
|
|
285
|
+
/** ISO 8601 timestamp of when the spec was generated */
|
|
286
|
+
timestamp: string;
|
|
287
|
+
/** Information about the tool that generated the spec */
|
|
288
|
+
generator: {
|
|
289
|
+
/** Tool name (e.g., '@doccov/cli', '@doccov/api') */
|
|
290
|
+
name: string;
|
|
291
|
+
/** Tool version */
|
|
292
|
+
version: string;
|
|
293
|
+
};
|
|
294
|
+
/** Details about the analysis process */
|
|
295
|
+
analysis: {
|
|
296
|
+
/** Entry point file that was analyzed (relative path) */
|
|
297
|
+
entryPoint: string;
|
|
298
|
+
/** How the entry point was detected */
|
|
299
|
+
entryPointSource: EntryPointDetectionMethod;
|
|
300
|
+
/** Whether this was a declaration-only analysis (.d.ts file) */
|
|
301
|
+
isDeclarationOnly: boolean;
|
|
302
|
+
/** Whether external types from node_modules were resolved */
|
|
303
|
+
resolvedExternalTypes: boolean;
|
|
304
|
+
/** Maximum type depth used for nested type resolution */
|
|
305
|
+
maxTypeDepth?: number;
|
|
306
|
+
};
|
|
307
|
+
/** Environment information during generation */
|
|
308
|
+
environment: {
|
|
309
|
+
/** Detected package manager */
|
|
310
|
+
packageManager?: string;
|
|
311
|
+
/** Whether node_modules was available for type resolution */
|
|
312
|
+
hasNodeModules: boolean;
|
|
313
|
+
/** Whether this is a monorepo */
|
|
314
|
+
isMonorepo?: boolean;
|
|
315
|
+
/** Target package name (for monorepos) */
|
|
316
|
+
targetPackage?: string;
|
|
317
|
+
};
|
|
318
|
+
/** Issues encountered during generation */
|
|
319
|
+
issues: GenerationIssue[];
|
|
320
|
+
/** Whether the result came from cache */
|
|
321
|
+
fromCache?: boolean;
|
|
322
|
+
};
|
|
259
323
|
/** Supported OpenPkg spec versions */
|
|
260
324
|
type OpenPkgVersion = "0.2.0" | "0.3.0";
|
|
261
325
|
type OpenPkg = {
|
|
@@ -266,6 +330,8 @@ type OpenPkg = {
|
|
|
266
330
|
types?: SpecType[];
|
|
267
331
|
examples?: SpecExample[];
|
|
268
332
|
extensions?: SpecExtension;
|
|
333
|
+
/** Required metadata about how this spec was generated */
|
|
334
|
+
generation: SpecGenerationInfo;
|
|
269
335
|
};
|
|
270
336
|
declare const SCHEMA_VERSION: OpenPkgVersion;
|
|
271
337
|
declare const SCHEMA_URL = "https://unpkg.com/@openpkg-ts/spec/schemas/v0.3.0/openpkg.schema.json";
|
|
@@ -363,4 +429,4 @@ declare function assertSpec(spec: unknown, version?: SchemaVersion): asserts spe
|
|
|
363
429
|
* @returns Array of validation errors (empty if valid)
|
|
364
430
|
*/
|
|
365
431
|
declare function getValidationErrors(spec: unknown, version?: SchemaVersion): SpecError[];
|
|
366
|
-
export { validateSpec, normalize, getValidationErrors, diffSpec, dereference, categorizeBreakingChanges, assertSpec, SpecVisibility, SpecTypeParameter, SpecTypeKind, SpecTypeAliasKind, SpecType, SpecThrows, SpecTag, SpecSource, SpecSignatureReturn, SpecSignatureParameter, SpecSignature, SpecSchemaRef, SpecSchemaPrimitive, SpecSchemaGeneric, SpecSchemaFallback, SpecSchemaComposite, SpecSchemaCombinator, SpecSchema, SpecRelationType, SpecRelation, SpecMember, SpecMappedType, SpecExtension, SpecExportKind, SpecExport, SpecExampleLanguage, SpecExample, SpecDocsMetadata, SpecDocDrift, SpecDiff, SpecDecorator, SpecConditionalType, SCHEMA_VERSION, SCHEMA_URL, OpenPkgVersion, OpenPkgMeta, OpenPkg, MemberChangeInfo, JSON_SCHEMA_DRAFT, DriftType, DriftCategory, DRIFT_CATEGORY_LABELS, DRIFT_CATEGORY_DESCRIPTIONS, DRIFT_CATEGORIES, CategorizedBreaking, BreakingSeverity };
|
|
432
|
+
export { validateSpec, normalize, getValidationErrors, diffSpec, dereference, categorizeBreakingChanges, assertSpec, SpecVisibility, SpecTypeParameter, SpecTypeKind, SpecTypeAliasKind, SpecType, SpecThrows, SpecTag, SpecSource, SpecSignatureReturn, SpecSignatureParameter, SpecSignature, SpecSchemaRef, SpecSchemaPrimitive, SpecSchemaGeneric, SpecSchemaFallback, SpecSchemaComposite, SpecSchemaCombinator, SpecSchema, SpecRelationType, SpecRelation, SpecMember, SpecMappedType, SpecGenerationInfo, SpecExtension, SpecExportKind, SpecExport, SpecExampleLanguage, SpecExample, SpecDocsMetadata, SpecDocDrift, SpecDiff, SpecDecorator, SpecConditionalType, SCHEMA_VERSION, SCHEMA_URL, OpenPkgVersion, OpenPkgMeta, OpenPkg, MemberChangeInfo, JSON_SCHEMA_DRAFT, GenerationIssueSeverity, GenerationIssue, EntryPointDetectionMethod, DriftType, DriftCategory, DRIFT_CATEGORY_LABELS, DRIFT_CATEGORY_DESCRIPTIONS, DRIFT_CATEGORIES, CategorizedBreaking, BreakingSeverity };
|
package/dist/index.js
CHANGED
|
@@ -1083,7 +1083,7 @@ var openpkg_schema_default3 = {
|
|
|
1083
1083
|
title: "OpenPkg Specification",
|
|
1084
1084
|
description: "Schema for OpenPkg specification files",
|
|
1085
1085
|
type: "object",
|
|
1086
|
-
required: ["openpkg", "meta", "exports"],
|
|
1086
|
+
required: ["openpkg", "meta", "exports", "generation"],
|
|
1087
1087
|
properties: {
|
|
1088
1088
|
$schema: {
|
|
1089
1089
|
type: "string",
|
|
@@ -1144,9 +1144,137 @@ var openpkg_schema_default3 = {
|
|
|
1144
1144
|
docs: {
|
|
1145
1145
|
$ref: "#/$defs/docsMetadata",
|
|
1146
1146
|
description: "Aggregate documentation coverage metadata"
|
|
1147
|
+
},
|
|
1148
|
+
generation: {
|
|
1149
|
+
$ref: "#/$defs/generationInfo",
|
|
1150
|
+
description: "Required metadata about how this spec was generated"
|
|
1147
1151
|
}
|
|
1148
1152
|
},
|
|
1149
1153
|
$defs: {
|
|
1154
|
+
entryPointDetectionMethod: {
|
|
1155
|
+
type: "string",
|
|
1156
|
+
description: "Method used to detect the entry point for analysis",
|
|
1157
|
+
enum: ["types", "exports", "main", "module", "fallback", "explicit", "llm"]
|
|
1158
|
+
},
|
|
1159
|
+
generationIssueSeverity: {
|
|
1160
|
+
type: "string",
|
|
1161
|
+
description: "Severity level for issues encountered during spec generation",
|
|
1162
|
+
enum: ["error", "warning", "info"]
|
|
1163
|
+
},
|
|
1164
|
+
generationIssue: {
|
|
1165
|
+
type: "object",
|
|
1166
|
+
description: "An issue encountered during spec generation",
|
|
1167
|
+
required: ["code", "message", "severity"],
|
|
1168
|
+
properties: {
|
|
1169
|
+
code: {
|
|
1170
|
+
type: "string",
|
|
1171
|
+
description: "Machine-readable issue code"
|
|
1172
|
+
},
|
|
1173
|
+
message: {
|
|
1174
|
+
type: "string",
|
|
1175
|
+
description: "Human-readable issue message"
|
|
1176
|
+
},
|
|
1177
|
+
severity: {
|
|
1178
|
+
$ref: "#/$defs/generationIssueSeverity"
|
|
1179
|
+
},
|
|
1180
|
+
suggestion: {
|
|
1181
|
+
type: "string",
|
|
1182
|
+
description: "Suggested resolution"
|
|
1183
|
+
}
|
|
1184
|
+
},
|
|
1185
|
+
additionalProperties: false
|
|
1186
|
+
},
|
|
1187
|
+
generationInfo: {
|
|
1188
|
+
type: "object",
|
|
1189
|
+
description: "Metadata about how the spec was generated",
|
|
1190
|
+
required: ["timestamp", "generator", "analysis", "environment", "issues"],
|
|
1191
|
+
properties: {
|
|
1192
|
+
timestamp: {
|
|
1193
|
+
type: "string",
|
|
1194
|
+
format: "date-time",
|
|
1195
|
+
description: "ISO 8601 timestamp of when the spec was generated"
|
|
1196
|
+
},
|
|
1197
|
+
generator: {
|
|
1198
|
+
type: "object",
|
|
1199
|
+
description: "Information about the tool that generated the spec",
|
|
1200
|
+
required: ["name", "version"],
|
|
1201
|
+
properties: {
|
|
1202
|
+
name: {
|
|
1203
|
+
type: "string",
|
|
1204
|
+
description: "Tool name (e.g., '@doccov/cli', '@doccov/api')"
|
|
1205
|
+
},
|
|
1206
|
+
version: {
|
|
1207
|
+
type: "string",
|
|
1208
|
+
description: "Tool version"
|
|
1209
|
+
}
|
|
1210
|
+
},
|
|
1211
|
+
additionalProperties: false
|
|
1212
|
+
},
|
|
1213
|
+
analysis: {
|
|
1214
|
+
type: "object",
|
|
1215
|
+
description: "Details about the analysis process",
|
|
1216
|
+
required: ["entryPoint", "entryPointSource", "isDeclarationOnly", "resolvedExternalTypes"],
|
|
1217
|
+
properties: {
|
|
1218
|
+
entryPoint: {
|
|
1219
|
+
type: "string",
|
|
1220
|
+
description: "Entry point file that was analyzed (relative path)"
|
|
1221
|
+
},
|
|
1222
|
+
entryPointSource: {
|
|
1223
|
+
$ref: "#/$defs/entryPointDetectionMethod"
|
|
1224
|
+
},
|
|
1225
|
+
isDeclarationOnly: {
|
|
1226
|
+
type: "boolean",
|
|
1227
|
+
description: "Whether this was a declaration-only analysis (.d.ts file)"
|
|
1228
|
+
},
|
|
1229
|
+
resolvedExternalTypes: {
|
|
1230
|
+
type: "boolean",
|
|
1231
|
+
description: "Whether external types from node_modules were resolved"
|
|
1232
|
+
},
|
|
1233
|
+
maxTypeDepth: {
|
|
1234
|
+
type: "integer",
|
|
1235
|
+
description: "Maximum type depth used for nested type resolution"
|
|
1236
|
+
}
|
|
1237
|
+
},
|
|
1238
|
+
additionalProperties: false
|
|
1239
|
+
},
|
|
1240
|
+
environment: {
|
|
1241
|
+
type: "object",
|
|
1242
|
+
description: "Environment information during generation",
|
|
1243
|
+
required: ["hasNodeModules"],
|
|
1244
|
+
properties: {
|
|
1245
|
+
packageManager: {
|
|
1246
|
+
type: "string",
|
|
1247
|
+
description: "Detected package manager"
|
|
1248
|
+
},
|
|
1249
|
+
hasNodeModules: {
|
|
1250
|
+
type: "boolean",
|
|
1251
|
+
description: "Whether node_modules was available for type resolution"
|
|
1252
|
+
},
|
|
1253
|
+
isMonorepo: {
|
|
1254
|
+
type: "boolean",
|
|
1255
|
+
description: "Whether this is a monorepo"
|
|
1256
|
+
},
|
|
1257
|
+
targetPackage: {
|
|
1258
|
+
type: "string",
|
|
1259
|
+
description: "Target package name (for monorepos)"
|
|
1260
|
+
}
|
|
1261
|
+
},
|
|
1262
|
+
additionalProperties: false
|
|
1263
|
+
},
|
|
1264
|
+
issues: {
|
|
1265
|
+
type: "array",
|
|
1266
|
+
description: "Issues encountered during generation",
|
|
1267
|
+
items: {
|
|
1268
|
+
$ref: "#/$defs/generationIssue"
|
|
1269
|
+
}
|
|
1270
|
+
},
|
|
1271
|
+
fromCache: {
|
|
1272
|
+
type: "boolean",
|
|
1273
|
+
description: "Whether the result came from cache"
|
|
1274
|
+
}
|
|
1275
|
+
},
|
|
1276
|
+
additionalProperties: false
|
|
1277
|
+
},
|
|
1150
1278
|
docSignal: {
|
|
1151
1279
|
type: "string",
|
|
1152
1280
|
enum: ["description", "params", "returns", "examples"]
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"title": "OpenPkg Specification",
|
|
5
5
|
"description": "Schema for OpenPkg specification files",
|
|
6
6
|
"type": "object",
|
|
7
|
-
"required": ["openpkg", "meta", "exports"],
|
|
7
|
+
"required": ["openpkg", "meta", "exports", "generation"],
|
|
8
8
|
"properties": {
|
|
9
9
|
"$schema": {
|
|
10
10
|
"type": "string",
|
|
@@ -65,9 +65,137 @@
|
|
|
65
65
|
"docs": {
|
|
66
66
|
"$ref": "#/$defs/docsMetadata",
|
|
67
67
|
"description": "Aggregate documentation coverage metadata"
|
|
68
|
+
},
|
|
69
|
+
"generation": {
|
|
70
|
+
"$ref": "#/$defs/generationInfo",
|
|
71
|
+
"description": "Required metadata about how this spec was generated"
|
|
68
72
|
}
|
|
69
73
|
},
|
|
70
74
|
"$defs": {
|
|
75
|
+
"entryPointDetectionMethod": {
|
|
76
|
+
"type": "string",
|
|
77
|
+
"description": "Method used to detect the entry point for analysis",
|
|
78
|
+
"enum": ["types", "exports", "main", "module", "fallback", "explicit", "llm"]
|
|
79
|
+
},
|
|
80
|
+
"generationIssueSeverity": {
|
|
81
|
+
"type": "string",
|
|
82
|
+
"description": "Severity level for issues encountered during spec generation",
|
|
83
|
+
"enum": ["error", "warning", "info"]
|
|
84
|
+
},
|
|
85
|
+
"generationIssue": {
|
|
86
|
+
"type": "object",
|
|
87
|
+
"description": "An issue encountered during spec generation",
|
|
88
|
+
"required": ["code", "message", "severity"],
|
|
89
|
+
"properties": {
|
|
90
|
+
"code": {
|
|
91
|
+
"type": "string",
|
|
92
|
+
"description": "Machine-readable issue code"
|
|
93
|
+
},
|
|
94
|
+
"message": {
|
|
95
|
+
"type": "string",
|
|
96
|
+
"description": "Human-readable issue message"
|
|
97
|
+
},
|
|
98
|
+
"severity": {
|
|
99
|
+
"$ref": "#/$defs/generationIssueSeverity"
|
|
100
|
+
},
|
|
101
|
+
"suggestion": {
|
|
102
|
+
"type": "string",
|
|
103
|
+
"description": "Suggested resolution"
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"additionalProperties": false
|
|
107
|
+
},
|
|
108
|
+
"generationInfo": {
|
|
109
|
+
"type": "object",
|
|
110
|
+
"description": "Metadata about how the spec was generated",
|
|
111
|
+
"required": ["timestamp", "generator", "analysis", "environment", "issues"],
|
|
112
|
+
"properties": {
|
|
113
|
+
"timestamp": {
|
|
114
|
+
"type": "string",
|
|
115
|
+
"format": "date-time",
|
|
116
|
+
"description": "ISO 8601 timestamp of when the spec was generated"
|
|
117
|
+
},
|
|
118
|
+
"generator": {
|
|
119
|
+
"type": "object",
|
|
120
|
+
"description": "Information about the tool that generated the spec",
|
|
121
|
+
"required": ["name", "version"],
|
|
122
|
+
"properties": {
|
|
123
|
+
"name": {
|
|
124
|
+
"type": "string",
|
|
125
|
+
"description": "Tool name (e.g., '@doccov/cli', '@doccov/api')"
|
|
126
|
+
},
|
|
127
|
+
"version": {
|
|
128
|
+
"type": "string",
|
|
129
|
+
"description": "Tool version"
|
|
130
|
+
}
|
|
131
|
+
},
|
|
132
|
+
"additionalProperties": false
|
|
133
|
+
},
|
|
134
|
+
"analysis": {
|
|
135
|
+
"type": "object",
|
|
136
|
+
"description": "Details about the analysis process",
|
|
137
|
+
"required": ["entryPoint", "entryPointSource", "isDeclarationOnly", "resolvedExternalTypes"],
|
|
138
|
+
"properties": {
|
|
139
|
+
"entryPoint": {
|
|
140
|
+
"type": "string",
|
|
141
|
+
"description": "Entry point file that was analyzed (relative path)"
|
|
142
|
+
},
|
|
143
|
+
"entryPointSource": {
|
|
144
|
+
"$ref": "#/$defs/entryPointDetectionMethod"
|
|
145
|
+
},
|
|
146
|
+
"isDeclarationOnly": {
|
|
147
|
+
"type": "boolean",
|
|
148
|
+
"description": "Whether this was a declaration-only analysis (.d.ts file)"
|
|
149
|
+
},
|
|
150
|
+
"resolvedExternalTypes": {
|
|
151
|
+
"type": "boolean",
|
|
152
|
+
"description": "Whether external types from node_modules were resolved"
|
|
153
|
+
},
|
|
154
|
+
"maxTypeDepth": {
|
|
155
|
+
"type": "integer",
|
|
156
|
+
"description": "Maximum type depth used for nested type resolution"
|
|
157
|
+
}
|
|
158
|
+
},
|
|
159
|
+
"additionalProperties": false
|
|
160
|
+
},
|
|
161
|
+
"environment": {
|
|
162
|
+
"type": "object",
|
|
163
|
+
"description": "Environment information during generation",
|
|
164
|
+
"required": ["hasNodeModules"],
|
|
165
|
+
"properties": {
|
|
166
|
+
"packageManager": {
|
|
167
|
+
"type": "string",
|
|
168
|
+
"description": "Detected package manager"
|
|
169
|
+
},
|
|
170
|
+
"hasNodeModules": {
|
|
171
|
+
"type": "boolean",
|
|
172
|
+
"description": "Whether node_modules was available for type resolution"
|
|
173
|
+
},
|
|
174
|
+
"isMonorepo": {
|
|
175
|
+
"type": "boolean",
|
|
176
|
+
"description": "Whether this is a monorepo"
|
|
177
|
+
},
|
|
178
|
+
"targetPackage": {
|
|
179
|
+
"type": "string",
|
|
180
|
+
"description": "Target package name (for monorepos)"
|
|
181
|
+
}
|
|
182
|
+
},
|
|
183
|
+
"additionalProperties": false
|
|
184
|
+
},
|
|
185
|
+
"issues": {
|
|
186
|
+
"type": "array",
|
|
187
|
+
"description": "Issues encountered during generation",
|
|
188
|
+
"items": {
|
|
189
|
+
"$ref": "#/$defs/generationIssue"
|
|
190
|
+
}
|
|
191
|
+
},
|
|
192
|
+
"fromCache": {
|
|
193
|
+
"type": "boolean",
|
|
194
|
+
"description": "Whether the result came from cache"
|
|
195
|
+
}
|
|
196
|
+
},
|
|
197
|
+
"additionalProperties": false
|
|
198
|
+
},
|
|
71
199
|
"docSignal": {
|
|
72
200
|
"type": "string",
|
|
73
201
|
"enum": ["description", "params", "returns", "examples"]
|