@openpkg-ts/spec 0.4.1 → 0.6.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.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // src/constants.ts
2
- var SCHEMA_VERSION = "0.2.0";
3
- var SCHEMA_URL = "https://unpkg.com/@openpkg-ts/spec/schemas/v0.2.0/openpkg.schema.json";
2
+ var SCHEMA_VERSION = "0.3.0";
3
+ var SCHEMA_URL = "https://unpkg.com/@openpkg-ts/spec/schemas/v0.3.0/openpkg.schema.json";
4
4
  var JSON_SCHEMA_DRAFT = "https://json-schema.org/draft/2020-12/schema";
5
5
  // src/deref.ts
6
6
  function dereference(spec) {
@@ -321,10 +321,10 @@ function normalizeType(item) {
321
321
  // src/validate.ts
322
322
  import Ajv from "ajv/dist/2020.js";
323
323
  import addFormats from "ajv-formats";
324
- // schemas/v0.2.0/openpkg.schema.json
324
+ // schemas/v0.1.0/openpkg.schema.json
325
325
  var openpkg_schema_default = {
326
326
  $schema: "https://json-schema.org/draft/2020-12/schema",
327
- $id: "https://unpkg.com/@openpkg-ts/spec/schemas/v0.2.0/openpkg.schema.json",
327
+ $id: "https://unpkg.com/@openpkg-ts/spec/schemas/v0.1.0/openpkg.schema.json",
328
328
  title: "OpenPkg Specification",
329
329
  description: "Schema for OpenPkg specification files",
330
330
  type: "object",
@@ -339,7 +339,7 @@ var openpkg_schema_default = {
339
339
  type: "string",
340
340
  description: "OpenPkg specification version",
341
341
  pattern: "^[0-9]+\\.[0-9]+\\.[0-9]+$",
342
- const: "0.2.0"
342
+ const: "0.1.0"
343
343
  },
344
344
  meta: {
345
345
  type: "object",
@@ -385,83 +385,9 @@ var openpkg_schema_default = {
385
385
  items: {
386
386
  $ref: "#/$defs/typeDef"
387
387
  }
388
- },
389
- docs: {
390
- $ref: "#/$defs/docsMetadata",
391
- description: "Aggregate documentation coverage metadata"
392
388
  }
393
389
  },
394
390
  $defs: {
395
- docSignal: {
396
- type: "string",
397
- enum: ["description", "params", "returns", "examples"]
398
- },
399
- docDrift: {
400
- type: "object",
401
- required: ["type", "issue"],
402
- properties: {
403
- type: {
404
- type: "string",
405
- enum: [
406
- "param-mismatch",
407
- "param-type-mismatch",
408
- "return-type-mismatch",
409
- "generic-constraint-mismatch",
410
- "optionality-mismatch",
411
- "deprecated-mismatch",
412
- "visibility-mismatch",
413
- "async-mismatch",
414
- "property-type-drift",
415
- "example-drift",
416
- "example-syntax-error",
417
- "example-runtime-error",
418
- "example-assertion-failed",
419
- "broken-link"
420
- ]
421
- },
422
- target: {
423
- type: "string",
424
- description: "Relevant identifier (e.g., parameter name)"
425
- },
426
- issue: {
427
- type: "string",
428
- description: "Human-friendly drift explanation"
429
- },
430
- suggestion: {
431
- type: "string",
432
- description: "Optional remediation hint"
433
- }
434
- },
435
- additionalProperties: false
436
- },
437
- docsMetadata: {
438
- type: "object",
439
- description: "Documentation coverage metadata",
440
- additionalProperties: false,
441
- properties: {
442
- coverageScore: {
443
- type: "number",
444
- minimum: 0,
445
- maximum: 100,
446
- description: "Documentation coverage value from 0-100."
447
- },
448
- missing: {
449
- type: "array",
450
- description: "Doc components missing for this entity",
451
- items: {
452
- $ref: "#/$defs/docSignal"
453
- },
454
- uniqueItems: true
455
- },
456
- drift: {
457
- type: "array",
458
- description: "Detected documentation drift signals",
459
- items: {
460
- $ref: "#/$defs/docDrift"
461
- }
462
- }
463
- }
464
- },
465
391
  export: {
466
392
  type: "object",
467
393
  required: ["id", "name", "kind"],
@@ -482,10 +408,6 @@ var openpkg_schema_default = {
482
408
  type: "string",
483
409
  description: "UI-friendly label"
484
410
  },
485
- alias: {
486
- type: "string",
487
- description: "Export alias if re-exported with a different name (id uses alias, name uses original)"
488
- },
489
411
  category: {
490
412
  type: "string",
491
413
  description: "Grouping hint for navigation"
@@ -497,16 +419,7 @@ var openpkg_schema_default = {
497
419
  kind: {
498
420
  type: "string",
499
421
  description: "Kind of export",
500
- enum: [
501
- "function",
502
- "class",
503
- "variable",
504
- "interface",
505
- "type",
506
- "enum",
507
- "namespace",
508
- "external"
509
- ]
422
+ enum: ["function", "class", "variable", "interface", "type", "enum"]
510
423
  },
511
424
  description: {
512
425
  type: "string",
@@ -535,15 +448,6 @@ var openpkg_schema_default = {
535
448
  description: "Class/interface/enum members",
536
449
  items: { type: "object" }
537
450
  },
538
- extends: {
539
- type: "string",
540
- description: "Base class or interface that this class/interface extends"
541
- },
542
- implements: {
543
- type: "array",
544
- description: "Interfaces implemented by this class",
545
- items: { type: "string" }
546
- },
547
451
  tags: {
548
452
  type: "array",
549
453
  description: "JSDoc/TSDoc tags",
@@ -559,10 +463,6 @@ var openpkg_schema_default = {
559
463
  },
560
464
  source: {
561
465
  $ref: "#/$defs/sourceLocation"
562
- },
563
- docs: {
564
- $ref: "#/$defs/docsMetadata",
565
- description: "Documentation coverage metadata for this export"
566
466
  }
567
467
  }
568
468
  },
@@ -586,10 +486,6 @@ var openpkg_schema_default = {
586
486
  type: "string",
587
487
  description: "UI-friendly label"
588
488
  },
589
- alias: {
590
- type: "string",
591
- description: "Export alias if re-exported with a different name (id uses alias, name uses original)"
592
- },
593
489
  category: {
594
490
  type: "string",
595
491
  description: "Grouping hint for navigation"
@@ -601,7 +497,7 @@ var openpkg_schema_default = {
601
497
  kind: {
602
498
  type: "string",
603
499
  description: "Kind of type definition",
604
- enum: ["interface", "type", "enum", "class", "external"]
500
+ enum: ["interface", "type", "enum", "class"]
605
501
  },
606
502
  description: {
607
503
  type: "string",
@@ -619,15 +515,6 @@ var openpkg_schema_default = {
619
515
  description: "Members for classes/interfaces/enums",
620
516
  items: { type: "object" }
621
517
  },
622
- extends: {
623
- type: "string",
624
- description: "Base class or interface that this class/interface extends"
625
- },
626
- implements: {
627
- type: "array",
628
- description: "Interfaces implemented by this class",
629
- items: { type: "string" }
630
- },
631
518
  tags: {
632
519
  type: "array",
633
520
  description: "JSDoc/TSDoc tags",
@@ -678,17 +565,6 @@ var openpkg_schema_default = {
678
565
  },
679
566
  schema: {
680
567
  $ref: "#/$defs/schema"
681
- },
682
- description: {
683
- type: "string",
684
- description: "Parameter description"
685
- },
686
- default: {
687
- description: "Default value for the parameter"
688
- },
689
- rest: {
690
- type: "boolean",
691
- description: "Whether this is a rest parameter (...args)"
692
568
  }
693
569
  }
694
570
  },
@@ -747,10 +623,10 @@ var openpkg_schema_default = {
747
623
  }
748
624
  }
749
625
  };
750
- // schemas/v0.1.0/openpkg.schema.json
626
+ // schemas/v0.2.0/openpkg.schema.json
751
627
  var openpkg_schema_default2 = {
752
628
  $schema: "https://json-schema.org/draft/2020-12/schema",
753
- $id: "https://unpkg.com/@openpkg-ts/spec/schemas/v0.1.0/openpkg.schema.json",
629
+ $id: "https://unpkg.com/@openpkg-ts/spec/schemas/v0.2.0/openpkg.schema.json",
754
630
  title: "OpenPkg Specification",
755
631
  description: "Schema for OpenPkg specification files",
756
632
  type: "object",
@@ -765,7 +641,7 @@ var openpkg_schema_default2 = {
765
641
  type: "string",
766
642
  description: "OpenPkg specification version",
767
643
  pattern: "^[0-9]+\\.[0-9]+\\.[0-9]+$",
768
- const: "0.1.0"
644
+ const: "0.2.0"
769
645
  },
770
646
  meta: {
771
647
  type: "object",
@@ -811,9 +687,83 @@ var openpkg_schema_default2 = {
811
687
  items: {
812
688
  $ref: "#/$defs/typeDef"
813
689
  }
690
+ },
691
+ docs: {
692
+ $ref: "#/$defs/docsMetadata",
693
+ description: "Aggregate documentation coverage metadata"
814
694
  }
815
695
  },
816
696
  $defs: {
697
+ docSignal: {
698
+ type: "string",
699
+ enum: ["description", "params", "returns", "examples"]
700
+ },
701
+ docDrift: {
702
+ type: "object",
703
+ required: ["type", "issue"],
704
+ properties: {
705
+ type: {
706
+ type: "string",
707
+ enum: [
708
+ "param-mismatch",
709
+ "param-type-mismatch",
710
+ "return-type-mismatch",
711
+ "generic-constraint-mismatch",
712
+ "optionality-mismatch",
713
+ "deprecated-mismatch",
714
+ "visibility-mismatch",
715
+ "async-mismatch",
716
+ "property-type-drift",
717
+ "example-drift",
718
+ "example-syntax-error",
719
+ "example-runtime-error",
720
+ "example-assertion-failed",
721
+ "broken-link"
722
+ ]
723
+ },
724
+ target: {
725
+ type: "string",
726
+ description: "Relevant identifier (e.g., parameter name)"
727
+ },
728
+ issue: {
729
+ type: "string",
730
+ description: "Human-friendly drift explanation"
731
+ },
732
+ suggestion: {
733
+ type: "string",
734
+ description: "Optional remediation hint"
735
+ }
736
+ },
737
+ additionalProperties: false
738
+ },
739
+ docsMetadata: {
740
+ type: "object",
741
+ description: "Documentation coverage metadata",
742
+ additionalProperties: false,
743
+ properties: {
744
+ coverageScore: {
745
+ type: "number",
746
+ minimum: 0,
747
+ maximum: 100,
748
+ description: "Documentation coverage value from 0-100."
749
+ },
750
+ missing: {
751
+ type: "array",
752
+ description: "Doc components missing for this entity",
753
+ items: {
754
+ $ref: "#/$defs/docSignal"
755
+ },
756
+ uniqueItems: true
757
+ },
758
+ drift: {
759
+ type: "array",
760
+ description: "Detected documentation drift signals",
761
+ items: {
762
+ $ref: "#/$defs/docDrift"
763
+ }
764
+ }
765
+ }
766
+ },
817
767
  export: {
818
768
  type: "object",
819
769
  required: ["id", "name", "kind"],
@@ -834,6 +784,10 @@ var openpkg_schema_default2 = {
834
784
  type: "string",
835
785
  description: "UI-friendly label"
836
786
  },
787
+ alias: {
788
+ type: "string",
789
+ description: "Export alias if re-exported with a different name (id uses alias, name uses original)"
790
+ },
837
791
  category: {
838
792
  type: "string",
839
793
  description: "Grouping hint for navigation"
@@ -845,7 +799,16 @@ var openpkg_schema_default2 = {
845
799
  kind: {
846
800
  type: "string",
847
801
  description: "Kind of export",
848
- enum: ["function", "class", "variable", "interface", "type", "enum"]
802
+ enum: [
803
+ "function",
804
+ "class",
805
+ "variable",
806
+ "interface",
807
+ "type",
808
+ "enum",
809
+ "namespace",
810
+ "external"
811
+ ]
849
812
  },
850
813
  description: {
851
814
  type: "string",
@@ -874,6 +837,15 @@ var openpkg_schema_default2 = {
874
837
  description: "Class/interface/enum members",
875
838
  items: { type: "object" }
876
839
  },
840
+ extends: {
841
+ type: "string",
842
+ description: "Base class or interface that this class/interface extends"
843
+ },
844
+ implements: {
845
+ type: "array",
846
+ description: "Interfaces implemented by this class",
847
+ items: { type: "string" }
848
+ },
877
849
  tags: {
878
850
  type: "array",
879
851
  description: "JSDoc/TSDoc tags",
@@ -889,6 +861,10 @@ var openpkg_schema_default2 = {
889
861
  },
890
862
  source: {
891
863
  $ref: "#/$defs/sourceLocation"
864
+ },
865
+ docs: {
866
+ $ref: "#/$defs/docsMetadata",
867
+ description: "Documentation coverage metadata for this export"
892
868
  }
893
869
  }
894
870
  },
@@ -912,6 +888,10 @@ var openpkg_schema_default2 = {
912
888
  type: "string",
913
889
  description: "UI-friendly label"
914
890
  },
891
+ alias: {
892
+ type: "string",
893
+ description: "Export alias if re-exported with a different name (id uses alias, name uses original)"
894
+ },
915
895
  category: {
916
896
  type: "string",
917
897
  description: "Grouping hint for navigation"
@@ -923,7 +903,7 @@ var openpkg_schema_default2 = {
923
903
  kind: {
924
904
  type: "string",
925
905
  description: "Kind of type definition",
926
- enum: ["interface", "type", "enum", "class"]
906
+ enum: ["interface", "type", "enum", "class", "external"]
927
907
  },
928
908
  description: {
929
909
  type: "string",
@@ -941,10 +921,19 @@ var openpkg_schema_default2 = {
941
921
  description: "Members for classes/interfaces/enums",
942
922
  items: { type: "object" }
943
923
  },
944
- tags: {
924
+ extends: {
925
+ type: "string",
926
+ description: "Base class or interface that this class/interface extends"
927
+ },
928
+ implements: {
945
929
  type: "array",
946
- description: "JSDoc/TSDoc tags",
947
- items: {
930
+ description: "Interfaces implemented by this class",
931
+ items: { type: "string" }
932
+ },
933
+ tags: {
934
+ type: "array",
935
+ description: "JSDoc/TSDoc tags",
936
+ items: {
948
937
  type: "object",
949
938
  required: ["name", "text"],
950
939
  properties: {
@@ -991,6 +980,17 @@ var openpkg_schema_default2 = {
991
980
  },
992
981
  schema: {
993
982
  $ref: "#/$defs/schema"
983
+ },
984
+ description: {
985
+ type: "string",
986
+ description: "Parameter description"
987
+ },
988
+ default: {
989
+ description: "Default value for the parameter"
990
+ },
991
+ rest: {
992
+ type: "boolean",
993
+ description: "Whether this is a rest parameter (...args)"
994
994
  }
995
995
  }
996
996
  },
@@ -1049,12 +1049,641 @@ var openpkg_schema_default2 = {
1049
1049
  }
1050
1050
  }
1051
1051
  };
1052
+ // schemas/v0.3.0/openpkg.schema.json
1053
+ var openpkg_schema_default3 = {
1054
+ $schema: "https://json-schema.org/draft/2020-12/schema",
1055
+ $id: "https://unpkg.com/@openpkg-ts/spec/schemas/v0.3.0/openpkg.schema.json",
1056
+ title: "OpenPkg Specification",
1057
+ description: "Schema for OpenPkg specification files",
1058
+ type: "object",
1059
+ required: ["openpkg", "meta", "exports"],
1060
+ properties: {
1061
+ $schema: {
1062
+ type: "string",
1063
+ description: "Reference to the OpenPkg schema version",
1064
+ pattern: "^(https://raw\\.githubusercontent\\.com/ryanwaits/openpkg/main/schemas/v[0-9]+\\.[0-9]+\\.[0-9]+/openpkg\\.schema\\.json|https://unpkg\\.com/@openpkg-ts/spec/schemas/v[0-9]+\\.[0-9]+\\.[0-9]+/openpkg\\.schema\\.json)$"
1065
+ },
1066
+ openpkg: {
1067
+ type: "string",
1068
+ description: "OpenPkg specification version",
1069
+ pattern: "^[0-9]+\\.[0-9]+\\.[0-9]+$",
1070
+ const: "0.3.0"
1071
+ },
1072
+ meta: {
1073
+ type: "object",
1074
+ description: "Package metadata",
1075
+ required: ["name"],
1076
+ properties: {
1077
+ name: {
1078
+ type: "string",
1079
+ description: "Package name"
1080
+ },
1081
+ version: {
1082
+ type: "string",
1083
+ description: "Package version"
1084
+ },
1085
+ description: {
1086
+ type: "string",
1087
+ description: "Package description"
1088
+ },
1089
+ license: {
1090
+ type: "string",
1091
+ description: "Package license"
1092
+ },
1093
+ repository: {
1094
+ type: "string",
1095
+ description: "Repository URL"
1096
+ },
1097
+ ecosystem: {
1098
+ type: "string",
1099
+ description: "Package ecosystem"
1100
+ }
1101
+ }
1102
+ },
1103
+ exports: {
1104
+ type: "array",
1105
+ description: "List of exported items",
1106
+ items: {
1107
+ $ref: "#/$defs/export"
1108
+ }
1109
+ },
1110
+ types: {
1111
+ type: "array",
1112
+ description: "List of type definitions",
1113
+ items: {
1114
+ $ref: "#/$defs/typeDef"
1115
+ }
1116
+ },
1117
+ docs: {
1118
+ $ref: "#/$defs/docsMetadata",
1119
+ description: "Aggregate documentation coverage metadata"
1120
+ }
1121
+ },
1122
+ $defs: {
1123
+ docSignal: {
1124
+ type: "string",
1125
+ enum: ["description", "params", "returns", "examples"]
1126
+ },
1127
+ docDrift: {
1128
+ type: "object",
1129
+ required: ["type", "issue"],
1130
+ properties: {
1131
+ type: {
1132
+ type: "string",
1133
+ enum: [
1134
+ "param-mismatch",
1135
+ "param-type-mismatch",
1136
+ "return-type-mismatch",
1137
+ "generic-constraint-mismatch",
1138
+ "optionality-mismatch",
1139
+ "deprecated-mismatch",
1140
+ "visibility-mismatch",
1141
+ "async-mismatch",
1142
+ "property-type-drift",
1143
+ "example-drift",
1144
+ "example-syntax-error",
1145
+ "example-runtime-error",
1146
+ "example-assertion-failed",
1147
+ "broken-link"
1148
+ ]
1149
+ },
1150
+ target: {
1151
+ type: "string",
1152
+ description: "Relevant identifier (e.g., parameter name)"
1153
+ },
1154
+ issue: {
1155
+ type: "string",
1156
+ description: "Human-friendly drift explanation"
1157
+ },
1158
+ suggestion: {
1159
+ type: "string",
1160
+ description: "Optional remediation hint"
1161
+ }
1162
+ },
1163
+ additionalProperties: false
1164
+ },
1165
+ docsMetadata: {
1166
+ type: "object",
1167
+ description: "Documentation coverage metadata",
1168
+ additionalProperties: false,
1169
+ properties: {
1170
+ coverageScore: {
1171
+ type: "number",
1172
+ minimum: 0,
1173
+ maximum: 100,
1174
+ description: "Documentation coverage value from 0-100."
1175
+ },
1176
+ missing: {
1177
+ type: "array",
1178
+ description: "Doc components missing for this entity",
1179
+ items: {
1180
+ $ref: "#/$defs/docSignal"
1181
+ },
1182
+ uniqueItems: true
1183
+ },
1184
+ drift: {
1185
+ type: "array",
1186
+ description: "Detected documentation drift signals",
1187
+ items: {
1188
+ $ref: "#/$defs/docDrift"
1189
+ }
1190
+ }
1191
+ }
1192
+ },
1193
+ export: {
1194
+ type: "object",
1195
+ required: ["id", "name", "kind"],
1196
+ properties: {
1197
+ id: {
1198
+ type: "string",
1199
+ description: "Unique identifier for the export"
1200
+ },
1201
+ name: {
1202
+ type: "string",
1203
+ description: "Export name"
1204
+ },
1205
+ slug: {
1206
+ type: "string",
1207
+ description: "Stable slug for linking"
1208
+ },
1209
+ displayName: {
1210
+ type: "string",
1211
+ description: "UI-friendly label"
1212
+ },
1213
+ alias: {
1214
+ type: "string",
1215
+ description: "Export alias if re-exported with a different name (id uses alias, name uses original)"
1216
+ },
1217
+ category: {
1218
+ type: "string",
1219
+ description: "Grouping hint for navigation"
1220
+ },
1221
+ importPath: {
1222
+ type: "string",
1223
+ description: "Recommended import path"
1224
+ },
1225
+ kind: {
1226
+ type: "string",
1227
+ description: "Kind of export",
1228
+ enum: [
1229
+ "function",
1230
+ "class",
1231
+ "variable",
1232
+ "interface",
1233
+ "type",
1234
+ "enum",
1235
+ "namespace",
1236
+ "external"
1237
+ ]
1238
+ },
1239
+ description: {
1240
+ type: "string",
1241
+ description: "JSDoc/TSDoc description"
1242
+ },
1243
+ examples: {
1244
+ type: "array",
1245
+ description: "Usage examples from documentation",
1246
+ items: {
1247
+ type: "string"
1248
+ }
1249
+ },
1250
+ signatures: {
1251
+ type: "array",
1252
+ description: "Function/method signatures",
1253
+ items: {
1254
+ $ref: "#/$defs/signature"
1255
+ }
1256
+ },
1257
+ type: {
1258
+ description: "Type reference or inline schema for variables",
1259
+ oneOf: [{ type: "string" }, { $ref: "#/$defs/schema" }]
1260
+ },
1261
+ members: {
1262
+ type: "array",
1263
+ description: "Class/interface/enum members",
1264
+ items: { type: "object" }
1265
+ },
1266
+ extends: {
1267
+ type: "string",
1268
+ description: "Base class or interface that this class/interface extends"
1269
+ },
1270
+ implements: {
1271
+ type: "array",
1272
+ description: "Interfaces implemented by this class",
1273
+ items: { type: "string" }
1274
+ },
1275
+ tags: {
1276
+ type: "array",
1277
+ description: "JSDoc/TSDoc tags",
1278
+ items: {
1279
+ $ref: "#/$defs/tag"
1280
+ }
1281
+ },
1282
+ source: {
1283
+ $ref: "#/$defs/sourceLocation"
1284
+ },
1285
+ docs: {
1286
+ $ref: "#/$defs/docsMetadata",
1287
+ description: "Documentation coverage metadata for this export"
1288
+ },
1289
+ typeAliasKind: {
1290
+ $ref: "#/$defs/typeAliasKind",
1291
+ description: "Kind of type alias (for type exports)"
1292
+ },
1293
+ conditionalType: {
1294
+ $ref: "#/$defs/conditionalType",
1295
+ description: "Structural details for conditional types"
1296
+ },
1297
+ mappedType: {
1298
+ $ref: "#/$defs/mappedType",
1299
+ description: "Structural details for mapped types"
1300
+ },
1301
+ decorators: {
1302
+ type: "array",
1303
+ description: "Decorators applied to this export (class/function)",
1304
+ items: { $ref: "#/$defs/decorator" }
1305
+ },
1306
+ isAugmentation: {
1307
+ type: "boolean",
1308
+ description: "True if this is a module augmentation (declare module)"
1309
+ },
1310
+ augmentedModule: {
1311
+ type: "string",
1312
+ description: "The module being augmented (e.g., 'express')"
1313
+ }
1314
+ }
1315
+ },
1316
+ typeDef: {
1317
+ type: "object",
1318
+ required: ["id", "name", "kind"],
1319
+ properties: {
1320
+ id: {
1321
+ type: "string",
1322
+ description: "Unique identifier for the type"
1323
+ },
1324
+ name: {
1325
+ type: "string",
1326
+ description: "Type name"
1327
+ },
1328
+ slug: {
1329
+ type: "string",
1330
+ description: "Stable slug for linking"
1331
+ },
1332
+ displayName: {
1333
+ type: "string",
1334
+ description: "UI-friendly label"
1335
+ },
1336
+ alias: {
1337
+ type: "string",
1338
+ description: "Export alias if re-exported with a different name (id uses alias, name uses original)"
1339
+ },
1340
+ category: {
1341
+ type: "string",
1342
+ description: "Grouping hint for navigation"
1343
+ },
1344
+ importPath: {
1345
+ type: "string",
1346
+ description: "Recommended import path"
1347
+ },
1348
+ kind: {
1349
+ type: "string",
1350
+ description: "Kind of type definition",
1351
+ enum: ["interface", "type", "enum", "class", "external"]
1352
+ },
1353
+ description: {
1354
+ type: "string",
1355
+ description: "JSDoc/TSDoc description"
1356
+ },
1357
+ schema: {
1358
+ $ref: "#/$defs/schema"
1359
+ },
1360
+ type: {
1361
+ type: "string",
1362
+ description: "Type expression for type aliases"
1363
+ },
1364
+ members: {
1365
+ type: "array",
1366
+ description: "Members for classes/interfaces/enums",
1367
+ items: { type: "object" }
1368
+ },
1369
+ extends: {
1370
+ type: "string",
1371
+ description: "Base class or interface that this class/interface extends"
1372
+ },
1373
+ implements: {
1374
+ type: "array",
1375
+ description: "Interfaces implemented by this class",
1376
+ items: { type: "string" }
1377
+ },
1378
+ tags: {
1379
+ type: "array",
1380
+ description: "JSDoc/TSDoc tags",
1381
+ items: {
1382
+ $ref: "#/$defs/tag"
1383
+ }
1384
+ },
1385
+ source: {
1386
+ $ref: "#/$defs/sourceLocation"
1387
+ },
1388
+ typeAliasKind: {
1389
+ $ref: "#/$defs/typeAliasKind",
1390
+ description: "Kind of type alias"
1391
+ },
1392
+ conditionalType: {
1393
+ $ref: "#/$defs/conditionalType",
1394
+ description: "Structural details for conditional types"
1395
+ },
1396
+ mappedType: {
1397
+ $ref: "#/$defs/mappedType",
1398
+ description: "Structural details for mapped types"
1399
+ }
1400
+ }
1401
+ },
1402
+ tag: {
1403
+ type: "object",
1404
+ description: "JSDoc/TSDoc tag with optional structured fields",
1405
+ required: ["name", "text"],
1406
+ properties: {
1407
+ name: {
1408
+ type: "string",
1409
+ description: "Tag name (e.g., 'param', 'returns', 'deprecated')"
1410
+ },
1411
+ text: {
1412
+ type: "string",
1413
+ description: "Full tag text content"
1414
+ },
1415
+ paramName: {
1416
+ type: "string",
1417
+ description: "For @param tags: the parameter name"
1418
+ },
1419
+ typeAnnotation: {
1420
+ type: "string",
1421
+ description: "For @param/@returns: type annotation if present"
1422
+ },
1423
+ reference: {
1424
+ type: "string",
1425
+ description: "For @see/@link: resolved URL or symbol reference"
1426
+ },
1427
+ language: {
1428
+ type: "string",
1429
+ description: "For @example: code language hint (e.g., 'typescript', 'json')"
1430
+ },
1431
+ version: {
1432
+ type: "string",
1433
+ description: "For @since/@version: semver value"
1434
+ },
1435
+ reason: {
1436
+ type: "string",
1437
+ description: "For @deprecated: migration path or deprecation reason"
1438
+ }
1439
+ },
1440
+ additionalProperties: true
1441
+ },
1442
+ signature: {
1443
+ type: "object",
1444
+ properties: {
1445
+ parameters: {
1446
+ type: "array",
1447
+ items: {
1448
+ $ref: "#/$defs/parameter"
1449
+ }
1450
+ },
1451
+ returns: {
1452
+ $ref: "#/$defs/returns"
1453
+ },
1454
+ description: {
1455
+ type: "string",
1456
+ description: "Signature-level description"
1457
+ },
1458
+ typeParameters: {
1459
+ type: "array",
1460
+ description: "Generic type parameters for this signature",
1461
+ items: {
1462
+ $ref: "#/$defs/typeParameter"
1463
+ }
1464
+ },
1465
+ overloadIndex: {
1466
+ type: "integer",
1467
+ minimum: 0,
1468
+ description: "Index of this overload (0-based), undefined for single signatures"
1469
+ },
1470
+ isImplementation: {
1471
+ type: "boolean",
1472
+ description: "True if this is the implementation signature (not user-callable)"
1473
+ },
1474
+ throws: {
1475
+ type: "array",
1476
+ description: "Exceptions that can be thrown by this signature",
1477
+ items: { $ref: "#/$defs/throwsInfo" }
1478
+ }
1479
+ }
1480
+ },
1481
+ typeParameter: {
1482
+ type: "object",
1483
+ required: ["name"],
1484
+ properties: {
1485
+ name: {
1486
+ type: "string",
1487
+ description: "Type parameter name (e.g., 'T', 'K')"
1488
+ },
1489
+ constraint: {
1490
+ type: "string",
1491
+ description: "Type constraint (e.g., 'extends string')"
1492
+ },
1493
+ default: {
1494
+ type: "string",
1495
+ description: "Default type value"
1496
+ }
1497
+ }
1498
+ },
1499
+ parameter: {
1500
+ type: "object",
1501
+ required: ["name", "required"],
1502
+ properties: {
1503
+ name: {
1504
+ type: "string",
1505
+ description: "Parameter name"
1506
+ },
1507
+ required: {
1508
+ type: "boolean",
1509
+ description: "Whether the parameter is required"
1510
+ },
1511
+ schema: {
1512
+ $ref: "#/$defs/schema"
1513
+ },
1514
+ description: {
1515
+ type: "string",
1516
+ description: "Parameter description"
1517
+ },
1518
+ default: {
1519
+ description: "Default value for the parameter"
1520
+ },
1521
+ rest: {
1522
+ type: "boolean",
1523
+ description: "Whether this is a rest parameter (...args)"
1524
+ },
1525
+ decorators: {
1526
+ type: "array",
1527
+ description: "Decorators applied to this parameter",
1528
+ items: { $ref: "#/$defs/decorator" }
1529
+ }
1530
+ }
1531
+ },
1532
+ returns: {
1533
+ type: "object",
1534
+ properties: {
1535
+ schema: {
1536
+ $ref: "#/$defs/schema"
1537
+ },
1538
+ description: {
1539
+ type: "string",
1540
+ description: "Return value description"
1541
+ }
1542
+ }
1543
+ },
1544
+ schema: {
1545
+ anyOf: [
1546
+ {
1547
+ type: "boolean"
1548
+ },
1549
+ {
1550
+ type: "object",
1551
+ properties: {
1552
+ $ref: {
1553
+ type: "string",
1554
+ description: "Reference to another type",
1555
+ pattern: "^#/types/[A-Za-z0-9_.-]+$"
1556
+ }
1557
+ },
1558
+ required: ["$ref"],
1559
+ additionalProperties: false
1560
+ },
1561
+ {
1562
+ type: "object",
1563
+ not: {
1564
+ required: ["$ref"]
1565
+ },
1566
+ additionalProperties: true
1567
+ }
1568
+ ]
1569
+ },
1570
+ sourceLocation: {
1571
+ type: "object",
1572
+ required: ["file", "line"],
1573
+ properties: {
1574
+ file: {
1575
+ type: "string",
1576
+ description: "Source file path"
1577
+ },
1578
+ line: {
1579
+ type: "integer",
1580
+ description: "Line number in source file",
1581
+ minimum: 1
1582
+ }
1583
+ }
1584
+ },
1585
+ typeAliasKind: {
1586
+ type: "string",
1587
+ description: "Kind of type alias",
1588
+ enum: ["alias", "conditional", "mapped", "template-literal", "infer"]
1589
+ },
1590
+ conditionalType: {
1591
+ type: "object",
1592
+ description: "Structural representation of a conditional type (T extends X ? Y : Z)",
1593
+ required: ["checkType", "extendsType", "trueType", "falseType"],
1594
+ properties: {
1595
+ checkType: {
1596
+ type: "string",
1597
+ description: "The type being checked (T)"
1598
+ },
1599
+ extendsType: {
1600
+ type: "string",
1601
+ description: "The constraint type (X)"
1602
+ },
1603
+ trueType: {
1604
+ type: "string",
1605
+ description: "The type when condition is true (Y)"
1606
+ },
1607
+ falseType: {
1608
+ type: "string",
1609
+ description: "The type when condition is false (Z)"
1610
+ }
1611
+ },
1612
+ additionalProperties: false
1613
+ },
1614
+ mappedType: {
1615
+ type: "object",
1616
+ description: "Structural representation of a mapped type ({ [K in keyof T]: ... })",
1617
+ required: ["typeParameter"],
1618
+ properties: {
1619
+ typeParameter: {
1620
+ type: "string",
1621
+ description: "The type parameter clause (e.g., 'K in keyof T')"
1622
+ },
1623
+ nameType: {
1624
+ type: "string",
1625
+ description: "The 'as' clause for key remapping (TS 4.1+)"
1626
+ },
1627
+ valueType: {
1628
+ type: "string",
1629
+ description: "The mapped value type"
1630
+ },
1631
+ readonly: {
1632
+ description: "Readonly modifier (+, -, or true for present)",
1633
+ oneOf: [{ type: "boolean" }, { enum: ["+", "-"] }]
1634
+ },
1635
+ optional: {
1636
+ description: "Optional modifier (+, -, or true for present)",
1637
+ oneOf: [{ type: "boolean" }, { enum: ["+", "-"] }]
1638
+ }
1639
+ },
1640
+ additionalProperties: false
1641
+ },
1642
+ decorator: {
1643
+ type: "object",
1644
+ description: "Decorator applied to a class, member, or parameter",
1645
+ required: ["name"],
1646
+ properties: {
1647
+ name: {
1648
+ type: "string",
1649
+ description: "Decorator name (e.g., 'Injectable', 'Component')"
1650
+ },
1651
+ arguments: {
1652
+ type: "array",
1653
+ description: "Evaluated decorator arguments (if possible)"
1654
+ },
1655
+ argumentsText: {
1656
+ type: "array",
1657
+ description: "Raw text of decorator arguments",
1658
+ items: { type: "string" }
1659
+ }
1660
+ },
1661
+ additionalProperties: false
1662
+ },
1663
+ throwsInfo: {
1664
+ type: "object",
1665
+ description: "Information about an exception that can be thrown",
1666
+ properties: {
1667
+ type: {
1668
+ type: "string",
1669
+ description: "Exception type (e.g., 'ValidationError', 'Error')"
1670
+ },
1671
+ description: {
1672
+ type: "string",
1673
+ description: "When/why the exception is thrown"
1674
+ }
1675
+ },
1676
+ additionalProperties: false
1677
+ }
1678
+ }
1679
+ };
1052
1680
 
1053
1681
  // src/validate.ts
1054
- var LATEST_VERSION = "0.2.0";
1682
+ var LATEST_VERSION = "0.3.0";
1055
1683
  var schemas = {
1056
- "0.1.0": openpkg_schema_default2,
1057
- "0.2.0": openpkg_schema_default
1684
+ "0.1.0": openpkg_schema_default,
1685
+ "0.2.0": openpkg_schema_default2,
1686
+ "0.3.0": openpkg_schema_default3
1058
1687
  };
1059
1688
  var ajv = new Ajv({
1060
1689
  strict: false,