@openpkg-ts/spec 0.49.0 → 0.52.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 +31 -1
- package/dist/index.js +53 -4
- package/package.json +3 -3
- package/schemas/v0.4.0/openpkg.schema.json +42 -3
package/dist/index.d.ts
CHANGED
|
@@ -11,6 +11,18 @@ type SpecTagParam = {
|
|
|
11
11
|
/** Whether param is marked optional with [brackets] */
|
|
12
12
|
optional?: boolean;
|
|
13
13
|
};
|
|
14
|
+
/**
|
|
15
|
+
* An inline TSDoc tag (`{@link Foo}`, `{@label Transport}`) found in a text field.
|
|
16
|
+
*
|
|
17
|
+
* Additive and side-car: the tag is left in place in the text it came from, so
|
|
18
|
+
* `{@link}` still reads naturally in prose and existing consumers are unaffected.
|
|
19
|
+
*/
|
|
20
|
+
type SpecInlineTag = {
|
|
21
|
+
/** Tag name without the `@` (e.g., "link", "label") */
|
|
22
|
+
name: string;
|
|
23
|
+
/** Tag content as written, trimmed (e.g., "sendBatch", "Transport") */
|
|
24
|
+
text: string;
|
|
25
|
+
};
|
|
14
26
|
type SpecTag = {
|
|
15
27
|
/** Tag name (e.g., "param", "returns", "example") */
|
|
16
28
|
name: string;
|
|
@@ -18,6 +30,8 @@ type SpecTag = {
|
|
|
18
30
|
text: string;
|
|
19
31
|
/** Structured data for @param tags */
|
|
20
32
|
param?: SpecTagParam;
|
|
33
|
+
/** Inline TSDoc tags found in `text` */
|
|
34
|
+
inlineTags?: SpecInlineTag[];
|
|
21
35
|
};
|
|
22
36
|
type SpecTypeAliasKind = "alias" | "conditional" | "mapped" | "template-literal" | "infer";
|
|
23
37
|
type SpecConditionalType = {
|
|
@@ -121,6 +135,8 @@ type SpecExample = {
|
|
|
121
135
|
title?: string;
|
|
122
136
|
description?: string;
|
|
123
137
|
language?: SpecExampleLanguage;
|
|
138
|
+
/** Inline TSDoc tags found in this example's text */
|
|
139
|
+
inlineTags?: SpecInlineTag[];
|
|
124
140
|
};
|
|
125
141
|
type SpecExtension = Record<string, unknown>;
|
|
126
142
|
/** Presentation metadata for an export/type (moved from inline fields) */
|
|
@@ -152,6 +168,8 @@ type SpecSignatureParameter = {
|
|
|
152
168
|
default?: unknown;
|
|
153
169
|
rest?: boolean;
|
|
154
170
|
decorators?: SpecDecorator[];
|
|
171
|
+
/** Inline TSDoc tags found in `description` */
|
|
172
|
+
inlineTags?: SpecInlineTag[];
|
|
155
173
|
};
|
|
156
174
|
type SpecSignatureReturn = {
|
|
157
175
|
schema: SpecSchema;
|
|
@@ -169,6 +187,8 @@ type SpecSignature = {
|
|
|
169
187
|
throws?: SpecThrows[];
|
|
170
188
|
/** Name of the base class this signature was inherited from (e.g. a subclass constructor declared only on its base) */
|
|
171
189
|
inheritedFrom?: string;
|
|
190
|
+
/** Inline TSDoc tags found in `description` */
|
|
191
|
+
inlineTags?: SpecInlineTag[];
|
|
172
192
|
};
|
|
173
193
|
/**
|
|
174
194
|
* Type predicate information for type guard functions.
|
|
@@ -257,6 +277,8 @@ type SpecMember = {
|
|
|
257
277
|
decorators?: SpecDecorator[];
|
|
258
278
|
deprecated?: boolean;
|
|
259
279
|
deprecationReason?: string;
|
|
280
|
+
/** Inline TSDoc tags found in `description` */
|
|
281
|
+
inlineTags?: SpecInlineTag[];
|
|
260
282
|
};
|
|
261
283
|
type SpecInheritedMember = SpecMember & {
|
|
262
284
|
/** Name of the class this member was inherited from */
|
|
@@ -286,6 +308,8 @@ type SpecExport = {
|
|
|
286
308
|
conditionalType?: SpecConditionalType;
|
|
287
309
|
mappedType?: SpecMappedType;
|
|
288
310
|
decorators?: SpecDecorator[];
|
|
311
|
+
/** Inline TSDoc tags found in `description` */
|
|
312
|
+
inlineTags?: SpecInlineTag[];
|
|
289
313
|
};
|
|
290
314
|
type SpecType = {
|
|
291
315
|
id: string;
|
|
@@ -306,6 +330,8 @@ type SpecType = {
|
|
|
306
330
|
mappedType?: SpecMappedType;
|
|
307
331
|
/** Whether this type is from an external package (node_modules) */
|
|
308
332
|
external?: boolean;
|
|
333
|
+
/** Inline TSDoc tags found in `description` */
|
|
334
|
+
inlineTags?: SpecInlineTag[];
|
|
309
335
|
};
|
|
310
336
|
type OpenPkgMeta = {
|
|
311
337
|
name: string;
|
|
@@ -413,6 +439,10 @@ type SpecGenerationMeta = {
|
|
|
413
439
|
schemaExtraction?: "hybrid";
|
|
414
440
|
/** Exports that were skipped during extraction */
|
|
415
441
|
skipped?: SpecSkippedExport[];
|
|
442
|
+
/** Entry file that was analyzed */
|
|
443
|
+
entryPoint?: string;
|
|
444
|
+
/** How the entry point was detected */
|
|
445
|
+
entryPointSource?: EntryPointDetectionMethod;
|
|
416
446
|
};
|
|
417
447
|
type OpenPkg = {
|
|
418
448
|
$schema?: string;
|
|
@@ -639,4 +669,4 @@ declare function assertSpec(spec: unknown, version?: SchemaVersion): asserts spe
|
|
|
639
669
|
* @returns Array of validation errors (empty if valid)
|
|
640
670
|
*/
|
|
641
671
|
declare function getValidationErrors(spec: unknown, version?: SchemaVersion): SpecError[];
|
|
642
|
-
export { validateSpec, resolveRef, recommendSemverBump, normalize, isVoidSchema, isTupleSchema, isStringSchema, isRefSchema, isOneOfSchema, isObjectSchema, isNumberSchema, isNullSchema, isNeverSchema, isIntegerSchema, isFunctionSchema, isBooleanSchema, isArraySchema, isAnySchema, isAnyOfSchema, isAllOfSchema, getValidationErrors, getSchemaType, getAvailableVersions, flattenAnyOf, diffSpec, dereference, categorizeBreakingChanges, calculateNextVersion, assertSpec, SpecVisibility, SpecTypePredicate, SpecTypeParameter, SpecTypeKind, SpecTypeAliasKind, SpecType, SpecThrows, SpecTagParam, SpecTag, SpecSource, SpecSkippedExport, SpecSignatureReturn, SpecSignatureParameter, SpecSignature, SpecSchemaRef, SpecSchemaPrimitive, SpecSchemaGeneric, SpecSchemaFallback, SpecSchemaComposite, SpecSchemaCombinator, SpecSchema, SpecPresentationMeta, SpecMember, SpecMappedType, SpecInheritedMember, SpecGenerationMeta, SpecGenerationInfo, SpecExtractionMode, SpecExtractionLimitation, SpecExtensions, SpecExtension, SpecExportKind, SpecExport, SpecExampleLanguage, SpecExample, SpecError, SpecDiff, SpecDecorator, SpecConditionalType, SemverRecommendation, SemverBump, SchemaVersion, SCHEMA_VERSION, SCHEMA_URL_MIRROR, SCHEMA_URL, OpenPkgVersion, OpenPkgMeta, OpenPkg, MemberChangeInfo, LATEST_VERSION, KIND_SLUGS, KIND_LABELS, JSON_SCHEMA_DRAFT, JSONSchemaExtensions, GenerationIssueSeverity, GenerationIssue, EntryPointDetectionMethod, DisplayKind, DiffOptions, DISPLAY_KIND_ORDER, CategorizedBreaking, BreakingSeverity };
|
|
672
|
+
export { validateSpec, resolveRef, recommendSemverBump, normalize, isVoidSchema, isTupleSchema, isStringSchema, isRefSchema, isOneOfSchema, isObjectSchema, isNumberSchema, isNullSchema, isNeverSchema, isIntegerSchema, isFunctionSchema, isBooleanSchema, isArraySchema, isAnySchema, isAnyOfSchema, isAllOfSchema, getValidationErrors, getSchemaType, getAvailableVersions, flattenAnyOf, diffSpec, dereference, categorizeBreakingChanges, calculateNextVersion, assertSpec, SpecVisibility, SpecTypePredicate, SpecTypeParameter, SpecTypeKind, SpecTypeAliasKind, SpecType, SpecThrows, SpecTagParam, SpecTag, SpecSource, SpecSkippedExport, SpecSignatureReturn, SpecSignatureParameter, SpecSignature, SpecSchemaRef, SpecSchemaPrimitive, SpecSchemaGeneric, SpecSchemaFallback, SpecSchemaComposite, SpecSchemaCombinator, SpecSchema, SpecPresentationMeta, SpecMember, SpecMappedType, SpecInlineTag, SpecInheritedMember, SpecGenerationMeta, SpecGenerationInfo, SpecExtractionMode, SpecExtractionLimitation, SpecExtensions, SpecExtension, SpecExportKind, SpecExport, SpecExampleLanguage, SpecExample, SpecError, SpecDiff, SpecDecorator, SpecConditionalType, SemverRecommendation, SemverBump, SchemaVersion, SCHEMA_VERSION, SCHEMA_URL_MIRROR, SCHEMA_URL, OpenPkgVersion, OpenPkgMeta, OpenPkg, MemberChangeInfo, LATEST_VERSION, KIND_SLUGS, KIND_LABELS, JSON_SCHEMA_DRAFT, JSONSchemaExtensions, GenerationIssueSeverity, GenerationIssue, EntryPointDetectionMethod, DisplayKind, DiffOptions, DISPLAY_KIND_ORDER, CategorizedBreaking, BreakingSeverity };
|
package/dist/index.js
CHANGED
|
@@ -167,7 +167,14 @@ function toMap(items) {
|
|
|
167
167
|
}
|
|
168
168
|
return map;
|
|
169
169
|
}
|
|
170
|
-
var DOC_KEYS = new Set([
|
|
170
|
+
var DOC_KEYS = new Set([
|
|
171
|
+
"description",
|
|
172
|
+
"examples",
|
|
173
|
+
"tags",
|
|
174
|
+
"inlineTags",
|
|
175
|
+
"rawComments",
|
|
176
|
+
"source"
|
|
177
|
+
]);
|
|
171
178
|
function isDocOnlyChange(a, b) {
|
|
172
179
|
const structuralA = normalizeForComparison(removeDocFields(a));
|
|
173
180
|
const structuralB = normalizeForComparison(removeDocFields(b));
|
|
@@ -463,6 +470,9 @@ function normalizeTag(tag) {
|
|
|
463
470
|
if (tag.param) {
|
|
464
471
|
result.param = tag.param;
|
|
465
472
|
}
|
|
473
|
+
if (tag.inlineTags && tag.inlineTags.length > 0) {
|
|
474
|
+
result.inlineTags = tag.inlineTags;
|
|
475
|
+
}
|
|
466
476
|
return result;
|
|
467
477
|
}
|
|
468
478
|
function normalizeMember(member) {
|
|
@@ -2317,6 +2327,11 @@ var openpkg_schema_default4 = {
|
|
|
2317
2327
|
reason: { type: "string" }
|
|
2318
2328
|
}
|
|
2319
2329
|
}
|
|
2330
|
+
},
|
|
2331
|
+
entryPoint: { type: "string" },
|
|
2332
|
+
entryPointSource: {
|
|
2333
|
+
type: "string",
|
|
2334
|
+
enum: ["types", "exports", "main", "module", "fallback", "explicit", "llm"]
|
|
2320
2335
|
}
|
|
2321
2336
|
}
|
|
2322
2337
|
},
|
|
@@ -2389,6 +2404,10 @@ var openpkg_schema_default4 = {
|
|
|
2389
2404
|
decorators: {
|
|
2390
2405
|
type: "array",
|
|
2391
2406
|
items: { $ref: "#/$defs/decorator" }
|
|
2407
|
+
},
|
|
2408
|
+
inlineTags: {
|
|
2409
|
+
type: "array",
|
|
2410
|
+
items: { $ref: "#/$defs/inlineTag" }
|
|
2392
2411
|
}
|
|
2393
2412
|
}
|
|
2394
2413
|
},
|
|
@@ -2424,6 +2443,10 @@ var openpkg_schema_default4 = {
|
|
|
2424
2443
|
conditionalType: { $ref: "#/$defs/conditionalType" },
|
|
2425
2444
|
mappedType: { $ref: "#/$defs/mappedType" },
|
|
2426
2445
|
external: { type: "boolean" },
|
|
2446
|
+
inlineTags: {
|
|
2447
|
+
type: "array",
|
|
2448
|
+
items: { $ref: "#/$defs/inlineTag" }
|
|
2449
|
+
},
|
|
2427
2450
|
typeParameters: {
|
|
2428
2451
|
type: "array",
|
|
2429
2452
|
items: { $ref: "#/$defs/typeParameter" }
|
|
@@ -2436,7 +2459,20 @@ var openpkg_schema_default4 = {
|
|
|
2436
2459
|
properties: {
|
|
2437
2460
|
name: { type: "string" },
|
|
2438
2461
|
text: { type: "string" },
|
|
2439
|
-
param: { $ref: "#/$defs/tagParam" }
|
|
2462
|
+
param: { $ref: "#/$defs/tagParam" },
|
|
2463
|
+
inlineTags: {
|
|
2464
|
+
type: "array",
|
|
2465
|
+
items: { $ref: "#/$defs/inlineTag" }
|
|
2466
|
+
}
|
|
2467
|
+
},
|
|
2468
|
+
additionalProperties: false
|
|
2469
|
+
},
|
|
2470
|
+
inlineTag: {
|
|
2471
|
+
type: "object",
|
|
2472
|
+
required: ["name", "text"],
|
|
2473
|
+
properties: {
|
|
2474
|
+
name: { type: "string" },
|
|
2475
|
+
text: { type: "string" }
|
|
2440
2476
|
},
|
|
2441
2477
|
additionalProperties: false
|
|
2442
2478
|
},
|
|
@@ -2478,6 +2514,10 @@ var openpkg_schema_default4 = {
|
|
|
2478
2514
|
throws: {
|
|
2479
2515
|
type: "array",
|
|
2480
2516
|
items: { $ref: "#/$defs/throwsInfo" }
|
|
2517
|
+
},
|
|
2518
|
+
inlineTags: {
|
|
2519
|
+
type: "array",
|
|
2520
|
+
items: { $ref: "#/$defs/inlineTag" }
|
|
2481
2521
|
}
|
|
2482
2522
|
}
|
|
2483
2523
|
},
|
|
@@ -2503,6 +2543,10 @@ var openpkg_schema_default4 = {
|
|
|
2503
2543
|
decorators: {
|
|
2504
2544
|
type: "array",
|
|
2505
2545
|
items: { $ref: "#/$defs/decorator" }
|
|
2546
|
+
},
|
|
2547
|
+
inlineTags: {
|
|
2548
|
+
type: "array",
|
|
2549
|
+
items: { $ref: "#/$defs/inlineTag" }
|
|
2506
2550
|
}
|
|
2507
2551
|
}
|
|
2508
2552
|
},
|
|
@@ -2683,7 +2727,11 @@ var openpkg_schema_default4 = {
|
|
|
2683
2727
|
code: { type: "string" },
|
|
2684
2728
|
title: { type: "string" },
|
|
2685
2729
|
description: { type: "string" },
|
|
2686
|
-
language: { $ref: "#/$defs/exampleLanguage" }
|
|
2730
|
+
language: { $ref: "#/$defs/exampleLanguage" },
|
|
2731
|
+
inlineTags: {
|
|
2732
|
+
type: "array",
|
|
2733
|
+
items: { $ref: "#/$defs/inlineTag" }
|
|
2734
|
+
}
|
|
2687
2735
|
},
|
|
2688
2736
|
additionalProperties: false
|
|
2689
2737
|
}
|
|
@@ -2705,7 +2753,8 @@ var openpkg_schema_default4 = {
|
|
|
2705
2753
|
flags: { type: "object", additionalProperties: true },
|
|
2706
2754
|
schema: { $ref: "#/$defs/schema" },
|
|
2707
2755
|
signatures: { type: "array", items: { $ref: "#/$defs/signature" } },
|
|
2708
|
-
decorators: { type: "array", items: { $ref: "#/$defs/decorator" } }
|
|
2756
|
+
decorators: { type: "array", items: { $ref: "#/$defs/decorator" } },
|
|
2757
|
+
inlineTags: { type: "array", items: { $ref: "#/$defs/inlineTag" } }
|
|
2709
2758
|
}
|
|
2710
2759
|
}
|
|
2711
2760
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openpkg-ts/spec",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.52.0",
|
|
4
4
|
"description": "Shared schema, validation, and diff utilities for OpenPkg specs",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"openpkg",
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"lint": "biome check src/",
|
|
38
38
|
"lint:fix": "biome check --write src/",
|
|
39
39
|
"format": "biome format --write src/",
|
|
40
|
-
"typecheck": "tsc --noEmit -p ."
|
|
40
|
+
"typecheck": "tsc --noEmit --types bun -p ."
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
43
|
"ajv": "^8.17.1",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"@types/bun": "latest",
|
|
48
48
|
"@types/node": "^20.0.0",
|
|
49
49
|
"bunup": "^0.16.20",
|
|
50
|
-
"typescript": "^5.0.0"
|
|
50
|
+
"typescript": "^5.0.0 || ^6.0.0"
|
|
51
51
|
},
|
|
52
52
|
"publishConfig": {
|
|
53
53
|
"access": "public"
|
|
@@ -72,6 +72,11 @@
|
|
|
72
72
|
"reason": { "type": "string" }
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
+
},
|
|
76
|
+
"entryPoint": { "type": "string" },
|
|
77
|
+
"entryPointSource": {
|
|
78
|
+
"type": "string",
|
|
79
|
+
"enum": ["types", "exports", "main", "module", "fallback", "explicit", "llm"]
|
|
75
80
|
}
|
|
76
81
|
}
|
|
77
82
|
},
|
|
@@ -144,6 +149,10 @@
|
|
|
144
149
|
"decorators": {
|
|
145
150
|
"type": "array",
|
|
146
151
|
"items": { "$ref": "#/$defs/decorator" }
|
|
152
|
+
},
|
|
153
|
+
"inlineTags": {
|
|
154
|
+
"type": "array",
|
|
155
|
+
"items": { "$ref": "#/$defs/inlineTag" }
|
|
147
156
|
}
|
|
148
157
|
}
|
|
149
158
|
},
|
|
@@ -179,6 +188,10 @@
|
|
|
179
188
|
"conditionalType": { "$ref": "#/$defs/conditionalType" },
|
|
180
189
|
"mappedType": { "$ref": "#/$defs/mappedType" },
|
|
181
190
|
"external": { "type": "boolean" },
|
|
191
|
+
"inlineTags": {
|
|
192
|
+
"type": "array",
|
|
193
|
+
"items": { "$ref": "#/$defs/inlineTag" }
|
|
194
|
+
},
|
|
182
195
|
"typeParameters": {
|
|
183
196
|
"type": "array",
|
|
184
197
|
"items": { "$ref": "#/$defs/typeParameter" }
|
|
@@ -191,7 +204,20 @@
|
|
|
191
204
|
"properties": {
|
|
192
205
|
"name": { "type": "string" },
|
|
193
206
|
"text": { "type": "string" },
|
|
194
|
-
"param": { "$ref": "#/$defs/tagParam" }
|
|
207
|
+
"param": { "$ref": "#/$defs/tagParam" },
|
|
208
|
+
"inlineTags": {
|
|
209
|
+
"type": "array",
|
|
210
|
+
"items": { "$ref": "#/$defs/inlineTag" }
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
"additionalProperties": false
|
|
214
|
+
},
|
|
215
|
+
"inlineTag": {
|
|
216
|
+
"type": "object",
|
|
217
|
+
"required": ["name", "text"],
|
|
218
|
+
"properties": {
|
|
219
|
+
"name": { "type": "string" },
|
|
220
|
+
"text": { "type": "string" }
|
|
195
221
|
},
|
|
196
222
|
"additionalProperties": false
|
|
197
223
|
},
|
|
@@ -233,6 +259,10 @@
|
|
|
233
259
|
"throws": {
|
|
234
260
|
"type": "array",
|
|
235
261
|
"items": { "$ref": "#/$defs/throwsInfo" }
|
|
262
|
+
},
|
|
263
|
+
"inlineTags": {
|
|
264
|
+
"type": "array",
|
|
265
|
+
"items": { "$ref": "#/$defs/inlineTag" }
|
|
236
266
|
}
|
|
237
267
|
}
|
|
238
268
|
},
|
|
@@ -258,6 +288,10 @@
|
|
|
258
288
|
"decorators": {
|
|
259
289
|
"type": "array",
|
|
260
290
|
"items": { "$ref": "#/$defs/decorator" }
|
|
291
|
+
},
|
|
292
|
+
"inlineTags": {
|
|
293
|
+
"type": "array",
|
|
294
|
+
"items": { "$ref": "#/$defs/inlineTag" }
|
|
261
295
|
}
|
|
262
296
|
}
|
|
263
297
|
},
|
|
@@ -438,7 +472,11 @@
|
|
|
438
472
|
"code": { "type": "string" },
|
|
439
473
|
"title": { "type": "string" },
|
|
440
474
|
"description": { "type": "string" },
|
|
441
|
-
"language": { "$ref": "#/$defs/exampleLanguage" }
|
|
475
|
+
"language": { "$ref": "#/$defs/exampleLanguage" },
|
|
476
|
+
"inlineTags": {
|
|
477
|
+
"type": "array",
|
|
478
|
+
"items": { "$ref": "#/$defs/inlineTag" }
|
|
479
|
+
}
|
|
442
480
|
},
|
|
443
481
|
"additionalProperties": false
|
|
444
482
|
}
|
|
@@ -460,7 +498,8 @@
|
|
|
460
498
|
"flags": { "type": "object", "additionalProperties": true },
|
|
461
499
|
"schema": { "$ref": "#/$defs/schema" },
|
|
462
500
|
"signatures": { "type": "array", "items": { "$ref": "#/$defs/signature" } },
|
|
463
|
-
"decorators": { "type": "array", "items": { "$ref": "#/$defs/decorator" } }
|
|
501
|
+
"decorators": { "type": "array", "items": { "$ref": "#/$defs/decorator" } },
|
|
502
|
+
"inlineTags": { "type": "array", "items": { "$ref": "#/$defs/inlineTag" } }
|
|
464
503
|
}
|
|
465
504
|
}
|
|
466
505
|
}
|