@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.d.ts +53 -6
- package/dist/index.js +771 -142
- package/package.json +1 -1
- package/schemas/v0.3.0/openpkg.schema.json +627 -0
package/dist/index.d.ts
CHANGED
|
@@ -1,9 +1,35 @@
|
|
|
1
|
-
declare const SCHEMA_VERSION = "0.2.0";
|
|
2
|
-
declare const SCHEMA_URL = "https://unpkg.com/@openpkg-ts/spec/schemas/v0.2.0/openpkg.schema.json";
|
|
3
|
-
declare const JSON_SCHEMA_DRAFT = "https://json-schema.org/draft/2020-12/schema";
|
|
4
1
|
type SpecTag = {
|
|
5
2
|
name: string;
|
|
6
3
|
text: string;
|
|
4
|
+
paramName?: string;
|
|
5
|
+
typeAnnotation?: string;
|
|
6
|
+
reference?: string;
|
|
7
|
+
language?: string;
|
|
8
|
+
version?: string;
|
|
9
|
+
reason?: string;
|
|
10
|
+
};
|
|
11
|
+
type SpecTypeAliasKind = "alias" | "conditional" | "mapped" | "template-literal" | "infer";
|
|
12
|
+
type SpecConditionalType = {
|
|
13
|
+
checkType: string;
|
|
14
|
+
extendsType: string;
|
|
15
|
+
trueType: string;
|
|
16
|
+
falseType: string;
|
|
17
|
+
};
|
|
18
|
+
type SpecMappedType = {
|
|
19
|
+
typeParameter: string;
|
|
20
|
+
nameType?: string;
|
|
21
|
+
valueType?: string;
|
|
22
|
+
readonly?: "+" | "-" | true;
|
|
23
|
+
optional?: "+" | "-" | true;
|
|
24
|
+
};
|
|
25
|
+
type SpecDecorator = {
|
|
26
|
+
name: string;
|
|
27
|
+
arguments?: unknown[];
|
|
28
|
+
argumentsText?: string[];
|
|
29
|
+
};
|
|
30
|
+
type SpecThrows = {
|
|
31
|
+
type?: string;
|
|
32
|
+
description?: string;
|
|
7
33
|
};
|
|
8
34
|
type SpecSource = {
|
|
9
35
|
file?: string;
|
|
@@ -36,6 +62,9 @@ type SpecSignatureParameter = {
|
|
|
36
62
|
required?: boolean;
|
|
37
63
|
description?: string;
|
|
38
64
|
schema: SpecSchema;
|
|
65
|
+
default?: unknown;
|
|
66
|
+
rest?: boolean;
|
|
67
|
+
decorators?: SpecDecorator[];
|
|
39
68
|
};
|
|
40
69
|
type SpecSignatureReturn = {
|
|
41
70
|
schema: SpecSchema;
|
|
@@ -47,6 +76,9 @@ type SpecSignature = {
|
|
|
47
76
|
returns?: SpecSignatureReturn;
|
|
48
77
|
description?: string;
|
|
49
78
|
typeParameters?: SpecTypeParameter[];
|
|
79
|
+
overloadIndex?: number;
|
|
80
|
+
isImplementation?: boolean;
|
|
81
|
+
throws?: SpecThrows[];
|
|
50
82
|
};
|
|
51
83
|
type SpecMember = {
|
|
52
84
|
id?: string;
|
|
@@ -58,6 +90,7 @@ type SpecMember = {
|
|
|
58
90
|
flags?: Record<string, unknown>;
|
|
59
91
|
schema?: SpecSchema;
|
|
60
92
|
signatures?: SpecSignature[];
|
|
93
|
+
decorators?: SpecDecorator[];
|
|
61
94
|
};
|
|
62
95
|
type SpecExportKind = "function" | "class" | "variable" | "interface" | "type" | "enum" | "module" | "namespace" | "reference" | "external";
|
|
63
96
|
type SpecTypeKind = "class" | "interface" | "type" | "enum" | "external";
|
|
@@ -84,6 +117,12 @@ type SpecExport = {
|
|
|
84
117
|
tags?: SpecTag[];
|
|
85
118
|
extends?: string;
|
|
86
119
|
implements?: string[];
|
|
120
|
+
typeAliasKind?: SpecTypeAliasKind;
|
|
121
|
+
conditionalType?: SpecConditionalType;
|
|
122
|
+
mappedType?: SpecMappedType;
|
|
123
|
+
decorators?: SpecDecorator[];
|
|
124
|
+
isAugmentation?: boolean;
|
|
125
|
+
augmentedModule?: string;
|
|
87
126
|
};
|
|
88
127
|
type SpecType = {
|
|
89
128
|
id: string;
|
|
@@ -103,6 +142,9 @@ type SpecType = {
|
|
|
103
142
|
rawComments?: string;
|
|
104
143
|
extends?: string;
|
|
105
144
|
implements?: string[];
|
|
145
|
+
typeAliasKind?: SpecTypeAliasKind;
|
|
146
|
+
conditionalType?: SpecConditionalType;
|
|
147
|
+
mappedType?: SpecMappedType;
|
|
106
148
|
};
|
|
107
149
|
type OpenPkgMeta = {
|
|
108
150
|
name: string;
|
|
@@ -112,9 +154,11 @@ type OpenPkgMeta = {
|
|
|
112
154
|
repository?: string;
|
|
113
155
|
ecosystem?: string;
|
|
114
156
|
};
|
|
157
|
+
/** Supported OpenPkg spec versions */
|
|
158
|
+
type OpenPkgVersion = "0.2.0" | "0.3.0";
|
|
115
159
|
type OpenPkg = {
|
|
116
160
|
$schema?: string;
|
|
117
|
-
openpkg:
|
|
161
|
+
openpkg: OpenPkgVersion;
|
|
118
162
|
meta: OpenPkgMeta;
|
|
119
163
|
exports: SpecExport[];
|
|
120
164
|
types?: SpecType[];
|
|
@@ -122,6 +166,9 @@ type OpenPkg = {
|
|
|
122
166
|
docs?: SpecDocsMetadata;
|
|
123
167
|
extensions?: SpecExtension;
|
|
124
168
|
};
|
|
169
|
+
declare const SCHEMA_VERSION: OpenPkgVersion;
|
|
170
|
+
declare const SCHEMA_URL = "https://unpkg.com/@openpkg-ts/spec/schemas/v0.3.0/openpkg.schema.json";
|
|
171
|
+
declare const JSON_SCHEMA_DRAFT = "https://json-schema.org/draft/2020-12/schema";
|
|
125
172
|
declare function dereference(spec: OpenPkg): OpenPkg;
|
|
126
173
|
type BreakingSeverity = "high" | "medium" | "low";
|
|
127
174
|
interface CategorizedBreaking {
|
|
@@ -164,7 +211,7 @@ declare function diffSpec(oldSpec: OpenPkg, newSpec: OpenPkg): SpecDiff;
|
|
|
164
211
|
declare function categorizeBreakingChanges(breaking: string[], oldSpec: OpenPkg, newSpec: OpenPkg, memberChanges?: MemberChangeInfo[]): CategorizedBreaking[];
|
|
165
212
|
declare function normalize(spec: OpenPkg): OpenPkg;
|
|
166
213
|
/** Supported schema versions */
|
|
167
|
-
type SchemaVersion = "0.1.0" | "0.2.0" | "latest";
|
|
214
|
+
type SchemaVersion = "0.1.0" | "0.2.0" | "0.3.0" | "latest";
|
|
168
215
|
type SpecError = {
|
|
169
216
|
instancePath: string;
|
|
170
217
|
message: string;
|
|
@@ -199,4 +246,4 @@ declare function assertSpec(spec: unknown, version?: SchemaVersion): asserts spe
|
|
|
199
246
|
* @returns Array of validation errors (empty if valid)
|
|
200
247
|
*/
|
|
201
248
|
declare function getValidationErrors(spec: unknown, version?: SchemaVersion): SpecError[];
|
|
202
|
-
export { validateSpec, normalize, getValidationErrors, diffSpec, dereference, categorizeBreakingChanges, assertSpec, SpecVisibility, SpecTypeParameter, SpecTypeKind, SpecType, SpecTag, SpecSource, SpecSignatureReturn, SpecSignatureParameter, SpecSignature, SpecSchema, SpecMember, SpecExtension, SpecExportKind, SpecExport, SpecExample, SpecDocsMetadata, SpecDocSignal, SpecDocDrift, SpecDiff, SCHEMA_VERSION, SCHEMA_URL, OpenPkgMeta, OpenPkg, MemberChangeInfo, JSON_SCHEMA_DRAFT, CategorizedBreaking, BreakingSeverity };
|
|
249
|
+
export { validateSpec, normalize, getValidationErrors, diffSpec, dereference, categorizeBreakingChanges, assertSpec, SpecVisibility, SpecTypeParameter, SpecTypeKind, SpecTypeAliasKind, SpecType, SpecThrows, SpecTag, SpecSource, SpecSignatureReturn, SpecSignatureParameter, SpecSignature, SpecSchema, SpecMember, SpecMappedType, SpecExtension, SpecExportKind, SpecExport, SpecExample, SpecDocsMetadata, SpecDocSignal, SpecDocDrift, SpecDiff, SpecDecorator, SpecConditionalType, SCHEMA_VERSION, SCHEMA_URL, OpenPkgVersion, OpenPkgMeta, OpenPkg, MemberChangeInfo, JSON_SCHEMA_DRAFT, CategorizedBreaking, BreakingSeverity };
|