dtsgenerator 3.19.1 → 4.0.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/.husky/pre-commit +0 -3
- package/.nycrc +1 -1
- package/README.md +7 -1
- package/dist/commandOptions.js +4 -3
- package/dist/core/astBuilder.js +29 -28
- package/dist/core/config.d.ts +1 -3
- package/dist/core/config.js +3 -4
- package/dist/core/index.js +1 -1
- package/dist/core/jsonSchema.js +7 -8
- package/dist/core/jsonSchemaDraft04.d.ts +4 -12
- package/dist/core/jsonSchemaDraft07.d.ts +6 -14
- package/dist/core/openApiV2.d.ts +11 -33
- package/dist/core/openApiV3.d.ts +17 -51
- package/dist/core/schemaId.d.ts +0 -1
- package/dist/core/type.d.ts +2 -2
- package/dist/core/type.js +7 -8
- package/dist/core/typeTree.js +1 -2
- package/dist/core/utils.js +4 -5
- package/dist/core/validateIdentifier.js +3 -4
- package/dist/jsonPointer.js +4 -5
- package/dist/utils.d.ts +0 -2
- package/dist/utils.js +16 -18
- package/docs/dependency-modernization.md +189 -0
- package/docs/npm-trusted-publishing.md +60 -0
- package/eslint.config.cjs +24 -0
- package/package.json +31 -30
- package/src/commandOptions.ts +2 -1
- package/src/core/astBuilder.ts +17 -10
- package/src/core/config.ts +1 -3
- package/src/core/dtsGenerator.ts +5 -7
- package/src/core/jsonSchema.ts +8 -12
- package/src/core/jsonSchemaDraft04.ts +6 -17
- package/src/core/jsonSchemaDraft07.ts +7 -17
- package/src/core/openApiV2.ts +31 -60
- package/src/core/openApiV3.ts +39 -60
- package/src/core/type.ts +6 -10
- package/src/core/utils.ts +1 -1
- package/src/core/validateIdentifier.ts +4 -5
- package/src/jsonPointer.ts +0 -2
- package/src/utils.ts +11 -11
- package/tsconfig.json +1 -1
- package/.eslintignore +0 -1
- package/.eslintrc.json +0 -30
package/src/core/openApiV2.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-empty-interface */
|
|
2
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
1
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
4
2
|
import { JsonSchemaDraft04 } from './jsonSchemaDraft04';
|
|
5
3
|
|
|
@@ -72,11 +70,7 @@ export namespace OpenApisV2 {
|
|
|
72
70
|
}
|
|
73
71
|
export type CollectionFormat = 'csv' | 'ssv' | 'tsv' | 'pipes';
|
|
74
72
|
export type CollectionFormatWithMulti =
|
|
75
|
-
| '
|
|
76
|
-
| 'ssv'
|
|
77
|
-
| 'tsv'
|
|
78
|
-
| 'pipes'
|
|
79
|
-
| 'multi';
|
|
73
|
+
'csv' | 'ssv' | 'tsv' | 'pipes' | 'multi';
|
|
80
74
|
/**
|
|
81
75
|
* Contact information for the owners of the API.
|
|
82
76
|
*/
|
|
@@ -98,15 +92,9 @@ export namespace OpenApisV2 {
|
|
|
98
92
|
/**
|
|
99
93
|
* One or more JSON objects describing the schemas being consumed and produced by the API.
|
|
100
94
|
*/
|
|
101
|
-
export
|
|
102
|
-
[
|
|
103
|
-
name: string
|
|
104
|
-
]: /* A deterministic version of a JSON Schema object. */ Schema;
|
|
105
|
-
}
|
|
95
|
+
export type Definitions = Record<string, Schema>;
|
|
106
96
|
export type Enum = JsonSchemaDraft04.Schema.Properties.Enum;
|
|
107
|
-
export
|
|
108
|
-
[name: string]: any;
|
|
109
|
-
}
|
|
97
|
+
export type Examples = Record<string, any>;
|
|
110
98
|
export type ExclusiveMaximum =
|
|
111
99
|
JsonSchemaDraft04.Schema.Properties.ExclusiveMaximum;
|
|
112
100
|
export type ExclusiveMinimum =
|
|
@@ -232,9 +220,7 @@ export namespace OpenApisV2 {
|
|
|
232
220
|
enum?: Enum;
|
|
233
221
|
multipleOf?: MultipleOf;
|
|
234
222
|
}
|
|
235
|
-
export
|
|
236
|
-
[name: string]: Header;
|
|
237
|
-
}
|
|
223
|
+
export type Headers = Record<string, Header>;
|
|
238
224
|
/**
|
|
239
225
|
* General information about the API.
|
|
240
226
|
*/
|
|
@@ -323,9 +309,7 @@ export namespace OpenApisV2 {
|
|
|
323
309
|
tokenUrl: string; // uri
|
|
324
310
|
description?: string;
|
|
325
311
|
}
|
|
326
|
-
export
|
|
327
|
-
[name: string]: string;
|
|
328
|
-
}
|
|
312
|
+
export type Oauth2Scopes = Record<string, string>;
|
|
329
313
|
export interface Operation {
|
|
330
314
|
tags?: string[];
|
|
331
315
|
/**
|
|
@@ -359,9 +343,7 @@ export namespace OpenApisV2 {
|
|
|
359
343
|
/**
|
|
360
344
|
* One or more JSON representations for parameters
|
|
361
345
|
*/
|
|
362
|
-
export
|
|
363
|
-
[name: string]: Parameter;
|
|
364
|
-
}
|
|
346
|
+
export type ParameterDefinitions = Record<string, Parameter>;
|
|
365
347
|
/**
|
|
366
348
|
* The parameters needed to send a valid API call.
|
|
367
349
|
*/
|
|
@@ -415,11 +397,9 @@ export namespace OpenApisV2 {
|
|
|
415
397
|
/**
|
|
416
398
|
* Relative paths to the individual endpoints. They must be relative to the 'basePath'.
|
|
417
399
|
*/
|
|
418
|
-
export
|
|
419
|
-
[pattern: string]: PathItem;
|
|
420
|
-
}
|
|
400
|
+
export type Paths = Record<string, PathItem>;
|
|
421
401
|
export type Pattern =
|
|
422
|
-
JsonSchemaDraft04.Schema.Properties.Pattern /* regex
|
|
402
|
+
JsonSchemaDraft04.Schema.Properties.Pattern; /* regex */
|
|
423
403
|
export interface PrimitivesItems {
|
|
424
404
|
type?: 'string' | 'number' | 'integer' | 'boolean' | 'array';
|
|
425
405
|
format?: string;
|
|
@@ -480,8 +460,9 @@ export namespace OpenApisV2 {
|
|
|
480
460
|
}
|
|
481
461
|
export interface Response {
|
|
482
462
|
description: string;
|
|
483
|
-
schema?:
|
|
484
|
-
|
|
463
|
+
schema?:
|
|
464
|
+
/* A deterministic version of a JSON Schema object. */
|
|
465
|
+
| Schema
|
|
485
466
|
| /* A deterministic version of a JSON Schema object. */ FileSchema;
|
|
486
467
|
headers?: Headers;
|
|
487
468
|
examples?: Examples;
|
|
@@ -489,18 +470,12 @@ export namespace OpenApisV2 {
|
|
|
489
470
|
/**
|
|
490
471
|
* One or more JSON representations for responses
|
|
491
472
|
*/
|
|
492
|
-
export
|
|
493
|
-
[name: string]: Response;
|
|
494
|
-
}
|
|
473
|
+
export type ResponseDefinitions = Record<string, Response>;
|
|
495
474
|
export type ResponseValue = Response | JsonReference;
|
|
496
475
|
/**
|
|
497
476
|
* Response objects names can either be any valid HTTP status code or 'default'.
|
|
498
477
|
*/
|
|
499
|
-
export
|
|
500
|
-
[
|
|
501
|
-
pattern: string
|
|
502
|
-
]: ResponseValue /* Patterns: ^([0-9]{3})$|^(default)$ | ^x- */;
|
|
503
|
-
}
|
|
478
|
+
export type Responses = Record<string, ResponseValue>;
|
|
504
479
|
/**
|
|
505
480
|
* A deterministic version of a JSON Schema object.
|
|
506
481
|
*/
|
|
@@ -525,11 +500,13 @@ export namespace OpenApisV2 {
|
|
|
525
500
|
minProperties?: JsonSchemaDraft04.Schema.Definitions.PositiveIntegerDefault0;
|
|
526
501
|
required?: JsonSchemaDraft04.Schema.Definitions.StringArray;
|
|
527
502
|
enum?: JsonSchemaDraft04.Schema.Properties.Enum;
|
|
528
|
-
additionalProperties?:
|
|
529
|
-
|
|
503
|
+
additionalProperties?:
|
|
504
|
+
/* A deterministic version of a JSON Schema object. */
|
|
505
|
+
Schema | boolean;
|
|
530
506
|
type?: JsonSchemaDraft04.Schema.Properties.Type;
|
|
531
|
-
items?:
|
|
532
|
-
|
|
507
|
+
items?:
|
|
508
|
+
/* A deterministic version of a JSON Schema object. */
|
|
509
|
+
| Schema
|
|
533
510
|
| [
|
|
534
511
|
/* A deterministic version of a JSON Schema object. */ Schema,
|
|
535
512
|
.../* A deterministic version of a JSON Schema object. */ Schema[],
|
|
@@ -538,11 +515,7 @@ export namespace OpenApisV2 {
|
|
|
538
515
|
/* A deterministic version of a JSON Schema object. */ Schema,
|
|
539
516
|
.../* A deterministic version of a JSON Schema object. */ Schema[],
|
|
540
517
|
];
|
|
541
|
-
properties?:
|
|
542
|
-
[
|
|
543
|
-
name: string
|
|
544
|
-
]: /* A deterministic version of a JSON Schema object. */ Schema;
|
|
545
|
-
};
|
|
518
|
+
properties?: Record<string, Schema>;
|
|
546
519
|
discriminator?: string;
|
|
547
520
|
readOnly?: boolean;
|
|
548
521
|
xml?: Xml;
|
|
@@ -554,18 +527,16 @@ export namespace OpenApisV2 {
|
|
|
554
527
|
*/
|
|
555
528
|
export type SchemesList = ('http' | 'https' | 'ws' | 'wss')[];
|
|
556
529
|
export type Security = SecurityRequirement[];
|
|
557
|
-
export
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
export
|
|
567
|
-
[name: string]: string[];
|
|
568
|
-
}
|
|
530
|
+
export type SecurityDefinitions = Record<
|
|
531
|
+
string,
|
|
532
|
+
| BasicAuthenticationSecurity
|
|
533
|
+
| ApiKeySecurity
|
|
534
|
+
| Oauth2ImplicitSecurity
|
|
535
|
+
| Oauth2PasswordSecurity
|
|
536
|
+
| Oauth2ApplicationSecurity
|
|
537
|
+
| Oauth2AccessCodeSecurity
|
|
538
|
+
>;
|
|
539
|
+
export type SecurityRequirement = Record<string, string[]>;
|
|
569
540
|
export interface Tag {
|
|
570
541
|
name: string;
|
|
571
542
|
description?: string;
|
|
@@ -583,5 +554,5 @@ export namespace OpenApisV2 {
|
|
|
583
554
|
}
|
|
584
555
|
}
|
|
585
556
|
}
|
|
586
|
-
|
|
557
|
+
|
|
587
558
|
export import SwaggerIo = OpenApisV2;
|
package/src/core/openApiV3.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-empty-
|
|
2
|
-
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-empty-object-type */
|
|
2
|
+
|
|
3
3
|
/* eslint-disable @typescript-eslint/no-namespace */
|
|
4
4
|
import { JsonSchemaDraft07 } from './jsonSchemaDraft07';
|
|
5
5
|
|
|
@@ -20,21 +20,18 @@ export namespace OpenApisV3 {
|
|
|
20
20
|
}
|
|
21
21
|
export namespace SchemaJson {
|
|
22
22
|
export namespace Definitions {
|
|
23
|
-
export
|
|
24
|
-
[name: string]: any;
|
|
25
|
-
}
|
|
23
|
+
export type Any = Record<string, any>;
|
|
26
24
|
export type AnyOrExpression = Any | Expression;
|
|
27
|
-
export
|
|
28
|
-
[name: string]: AnyOrExpression;
|
|
29
|
-
}
|
|
25
|
+
export type AnysOrExpressions = Record<string, AnyOrExpression>;
|
|
30
26
|
/**
|
|
31
27
|
* A map of possible out-of band callbacks related to the parent operation. Each value in the map is a Path Item Object that describes a set of requests that may be initiated by the API provider and the expected responses. The key value used to identify the callback object is an expression, evaluated at runtime, that identifies a URL to use for the callback operation.
|
|
32
28
|
*/
|
|
33
29
|
export interface Callback {}
|
|
34
30
|
export type CallbackOrReference = Callback | Reference;
|
|
35
|
-
export
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
export type CallbacksOrReferences = Record<
|
|
32
|
+
string,
|
|
33
|
+
CallbackOrReference
|
|
34
|
+
>;
|
|
38
35
|
/**
|
|
39
36
|
* Holds a set of reusable objects for different aspects of the OAS. All objects defined within the components object will have no effect on the API unless they are explicitly referenced from properties outside the components object.
|
|
40
37
|
*/
|
|
@@ -75,9 +72,7 @@ export namespace OpenApisV3 {
|
|
|
75
72
|
explode?: boolean;
|
|
76
73
|
allowReserved?: boolean;
|
|
77
74
|
}
|
|
78
|
-
export
|
|
79
|
-
[name: string]: Encoding;
|
|
80
|
-
}
|
|
75
|
+
export type Encodings = Record<string, Encoding>;
|
|
81
76
|
/**
|
|
82
77
|
*
|
|
83
78
|
*/
|
|
@@ -88,12 +83,11 @@ export namespace OpenApisV3 {
|
|
|
88
83
|
externalValue?: string;
|
|
89
84
|
}
|
|
90
85
|
export type ExampleOrReference = Example | Reference;
|
|
91
|
-
export
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
}
|
|
86
|
+
export type ExamplesOrReferences = Record<
|
|
87
|
+
string,
|
|
88
|
+
ExampleOrReference
|
|
89
|
+
>;
|
|
90
|
+
export type Expression = Record<string, any>;
|
|
97
91
|
/**
|
|
98
92
|
* Allows referencing an external resource for extended documentation.
|
|
99
93
|
*/
|
|
@@ -118,9 +112,7 @@ export namespace OpenApisV3 {
|
|
|
118
112
|
content?: MediaTypes;
|
|
119
113
|
}
|
|
120
114
|
export type HeaderOrReference = Header | Reference;
|
|
121
|
-
export
|
|
122
|
-
[name: string]: HeaderOrReference;
|
|
123
|
-
}
|
|
115
|
+
export type HeadersOrReferences = Record<string, HeaderOrReference>;
|
|
124
116
|
/**
|
|
125
117
|
* The object provides metadata about the API. The metadata MAY be used by the clients if needed, and MAY be presented in editing or documentation generation tools for convenience.
|
|
126
118
|
*/
|
|
@@ -151,9 +143,7 @@ export namespace OpenApisV3 {
|
|
|
151
143
|
server?: Server;
|
|
152
144
|
}
|
|
153
145
|
export type LinkOrReference = Link | Reference;
|
|
154
|
-
export
|
|
155
|
-
[name: string]: LinkOrReference;
|
|
156
|
-
}
|
|
146
|
+
export type LinksOrReferences = Record<string, LinkOrReference>;
|
|
157
147
|
/**
|
|
158
148
|
* Each Media Type Object provides schema and examples for the media type identified by its key.
|
|
159
149
|
*/
|
|
@@ -163,9 +153,7 @@ export namespace OpenApisV3 {
|
|
|
163
153
|
examples?: ExamplesOrReferences;
|
|
164
154
|
encoding?: Encodings;
|
|
165
155
|
}
|
|
166
|
-
export
|
|
167
|
-
[name: string]: MediaType;
|
|
168
|
-
}
|
|
156
|
+
export type MediaTypes = Record<string, MediaType>;
|
|
169
157
|
/**
|
|
170
158
|
* Configuration details for a supported OAuth Flow
|
|
171
159
|
*/
|
|
@@ -220,9 +208,10 @@ export namespace OpenApisV3 {
|
|
|
220
208
|
content?: MediaTypes;
|
|
221
209
|
}
|
|
222
210
|
export type ParameterOrReference = Parameter | Reference;
|
|
223
|
-
export
|
|
224
|
-
|
|
225
|
-
|
|
211
|
+
export type ParametersOrReferences = Record<
|
|
212
|
+
string,
|
|
213
|
+
ParameterOrReference
|
|
214
|
+
>;
|
|
226
215
|
/**
|
|
227
216
|
* Describes the operations available on a single path. A Path Item MAY be empty, due to ACL constraints. The path itself is still exposed to the documentation viewer but they will not know which operations and parameters are available.
|
|
228
217
|
*/
|
|
@@ -245,18 +234,17 @@ export namespace OpenApisV3 {
|
|
|
245
234
|
/**
|
|
246
235
|
* Holds the relative paths to the individual endpoints and their operations. The path is appended to the URL from the `Server Object` in order to construct the full URL. The Paths MAY be empty, due to ACL constraints.
|
|
247
236
|
*/
|
|
248
|
-
export
|
|
249
|
-
[name: string]: PathItemOrReference;
|
|
250
|
-
}
|
|
237
|
+
export type Paths = Record<string, PathItemOrReference>;
|
|
251
238
|
/**
|
|
252
239
|
* A simple object to allow referencing other components in the specification, internally and externally. The Reference Object is defined by JSON Reference and follows the same structure, behavior and rules. For this specification, reference resolution is accomplished as defined by the JSON Reference specification and not by the JSON Schema specification.
|
|
253
240
|
*/
|
|
254
241
|
export interface Reference {
|
|
255
242
|
$ref: string;
|
|
256
243
|
}
|
|
257
|
-
export
|
|
258
|
-
|
|
259
|
-
|
|
244
|
+
export type RequestBodiesOrReferences = Record<
|
|
245
|
+
string,
|
|
246
|
+
RequestBodyOrReference
|
|
247
|
+
>;
|
|
260
248
|
/**
|
|
261
249
|
* Describes a single request body.
|
|
262
250
|
*/
|
|
@@ -279,15 +267,13 @@ export namespace OpenApisV3 {
|
|
|
279
267
|
/**
|
|
280
268
|
* A container for the expected responses of an operation. The container maps a HTTP response code to the expected response. The documentation is not necessarily expected to cover all possible HTTP response codes because they may not be known in advance. However, documentation is expected to cover a successful operation response and any known errors. The `default` MAY be used as a default response object for all HTTP codes that are not covered individually by the specification. The `Responses Object` MUST contain at least one response code, and it SHOULD be the response for a successful operation call.
|
|
281
269
|
*/
|
|
282
|
-
export
|
|
283
|
-
|
|
284
|
-
|
|
270
|
+
export type ResponsesOrReferences = Record<
|
|
271
|
+
string,
|
|
272
|
+
ResponseOrReference
|
|
273
|
+
>;
|
|
285
274
|
export type SchemaOrReference =
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
export interface SchemasOrReferences {
|
|
289
|
-
[name: string]: SchemaOrReference;
|
|
290
|
-
}
|
|
275
|
+
JsonSchemaDraft07.SchemaObject | Reference;
|
|
276
|
+
export type SchemasOrReferences = Record<string, SchemaOrReference>;
|
|
291
277
|
/**
|
|
292
278
|
* Lists the required security schemes to execute this operation. The name used for each property MUST correspond to a security scheme declared in the Security Schemes under the Components Object. Security Requirement Objects that contain multiple schemes require that all schemes MUST be satisfied for a request to be authorized. This enables support for scenarios where multiple query parameters or HTTP headers are required to convey security information. When a list of Security Requirement Objects is defined on the Open API object or Operation Object, only one of Security Requirement Objects in the list needs to be satisfied to authorize the request.
|
|
293
279
|
*/
|
|
@@ -306,9 +292,10 @@ export namespace OpenApisV3 {
|
|
|
306
292
|
openIdConnectUrl?: string;
|
|
307
293
|
}
|
|
308
294
|
export type SecuritySchemeOrReference = SecurityScheme | Reference;
|
|
309
|
-
export
|
|
310
|
-
|
|
311
|
-
|
|
295
|
+
export type SecuritySchemesOrReferences = Record<
|
|
296
|
+
string,
|
|
297
|
+
SecuritySchemeOrReference
|
|
298
|
+
>;
|
|
312
299
|
/**
|
|
313
300
|
* An object representing a Server.
|
|
314
301
|
*/
|
|
@@ -325,21 +312,13 @@ export namespace OpenApisV3 {
|
|
|
325
312
|
default: string;
|
|
326
313
|
description?: string;
|
|
327
314
|
}
|
|
328
|
-
export
|
|
329
|
-
[name: string]: ServerVariable;
|
|
330
|
-
}
|
|
315
|
+
export type ServerVariables = Record<string, ServerVariable>;
|
|
331
316
|
/**
|
|
332
317
|
* Any property starting with x- is valid.
|
|
333
318
|
*/
|
|
334
319
|
export type SpecificationExtension =
|
|
335
|
-
|
|
|
336
|
-
|
|
337
|
-
| boolean
|
|
338
|
-
| string
|
|
339
|
-
| any[];
|
|
340
|
-
export interface Strings {
|
|
341
|
-
[name: string]: string;
|
|
342
|
-
}
|
|
320
|
+
null | number | boolean | string | any[];
|
|
321
|
+
export type Strings = Record<string, string>;
|
|
343
322
|
/**
|
|
344
323
|
* Adds metadata to a single tag that is used by the Operation Object. It is not mandatory to have a Tag Object per tag defined in the Operation Object instances.
|
|
345
324
|
*/
|
package/src/core/type.ts
CHANGED
|
@@ -12,21 +12,17 @@ import { OpenApisV3 } from './openApiV3';
|
|
|
12
12
|
import SchemaId from './schemaId';
|
|
13
13
|
|
|
14
14
|
// export `ts` for using the same version of TypeScript in all plugins.
|
|
15
|
-
|
|
15
|
+
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-require-imports
|
|
16
17
|
export import ts = require('typescript');
|
|
17
18
|
|
|
18
19
|
// Schema types
|
|
19
20
|
|
|
20
21
|
export type JsonSchema = JsonSchemaDraft04.Schema | JsonSchemaDraft07.Schema;
|
|
21
22
|
export type JsonSchemaObject =
|
|
22
|
-
|
|
|
23
|
-
| JsonSchemaDraft07.SchemaObject;
|
|
23
|
+
JsonSchemaDraft04.Schema | JsonSchemaDraft07.SchemaObject;
|
|
24
24
|
export type SchemaType =
|
|
25
|
-
| '
|
|
26
|
-
| 'Draft07'
|
|
27
|
-
| '2019-09'
|
|
28
|
-
| '2020-12'
|
|
29
|
-
| 'Latest';
|
|
25
|
+
'Draft04' | 'Draft07' | '2019-09' | '2020-12' | 'Latest';
|
|
30
26
|
export function isJsonSchemaDraft04(
|
|
31
27
|
_content: JsonSchemaObject,
|
|
32
28
|
type: SchemaType,
|
|
@@ -119,7 +115,7 @@ export interface PluginContext {
|
|
|
119
115
|
|
|
120
116
|
export type PreProcessHandler = (contents: Schema[]) => Schema[];
|
|
121
117
|
|
|
122
|
-
export
|
|
118
|
+
export interface Plugin {
|
|
123
119
|
meta: {
|
|
124
120
|
name: string;
|
|
125
121
|
version: string;
|
|
@@ -131,7 +127,7 @@ export type Plugin = {
|
|
|
131
127
|
postProcess?: (
|
|
132
128
|
context: PluginContext,
|
|
133
129
|
) => Promise<TransformerFactory<SourceFile> | undefined>;
|
|
134
|
-
}
|
|
130
|
+
}
|
|
135
131
|
|
|
136
132
|
export async function loadPlugin(
|
|
137
133
|
name: string,
|
package/src/core/utils.ts
CHANGED
|
@@ -78,9 +78,9 @@ export function checkValidMIMEType(mime: string): boolean {
|
|
|
78
78
|
return /^application\/(?:[a-z0-9-_.]+\+)?json5?$/.test(type);
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
82
81
|
export function mergeSchema(a: any, b: any): boolean {
|
|
83
82
|
if ('$ref' in a || '$ref' in b) {
|
|
83
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing
|
|
84
84
|
a.$ref = b.$ref || a.$ref;
|
|
85
85
|
return false;
|
|
86
86
|
}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
2
1
|
/* eslint-disable @typescript-eslint/no-unsafe-enum-comparison */
|
|
3
2
|
import { ScriptTarget } from 'typescript';
|
|
4
3
|
|
|
@@ -785,16 +784,16 @@ function isUnicodeIdentifierStart(code: number, languageVersion: ScriptTarget) {
|
|
|
785
784
|
return languageVersion >= ScriptTarget.ES2015
|
|
786
785
|
? lookupInUnicodeMap(code, unicodeESNextIdentifierStart)
|
|
787
786
|
: languageVersion === ScriptTarget.ES5
|
|
788
|
-
|
|
789
|
-
|
|
787
|
+
? lookupInUnicodeMap(code, unicodeES5IdentifierStart)
|
|
788
|
+
: lookupInUnicodeMap(code, unicodeES3IdentifierStart);
|
|
790
789
|
}
|
|
791
790
|
|
|
792
791
|
function isUnicodeIdentifierPart(code: number, languageVersion: ScriptTarget) {
|
|
793
792
|
return languageVersion >= ScriptTarget.ES2015
|
|
794
793
|
? lookupInUnicodeMap(code, unicodeESNextIdentifierPart)
|
|
795
794
|
: languageVersion === ScriptTarget.ES5
|
|
796
|
-
|
|
797
|
-
|
|
795
|
+
? lookupInUnicodeMap(code, unicodeES5IdentifierPart)
|
|
796
|
+
: lookupInUnicodeMap(code, unicodeES3IdentifierPart);
|
|
798
797
|
}
|
|
799
798
|
|
|
800
799
|
function isIdentifierStart(ch: number, languageVersion: ScriptTarget): boolean {
|
package/src/jsonPointer.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
|
2
1
|
/* eslint-disable @typescript-eslint/no-unsafe-assignment */
|
|
3
2
|
/* eslint-disable @typescript-eslint/no-unsafe-member-access */
|
|
4
|
-
/* eslint-disable @typescript-eslint/no-unsafe-return */
|
|
5
3
|
|
|
6
4
|
export function get(
|
|
7
5
|
obj: any,
|
package/src/utils.ts
CHANGED
|
@@ -16,6 +16,8 @@ export function readStream(
|
|
|
16
16
|
let data = '';
|
|
17
17
|
stream.on('data', (chunk) => (data += chunk));
|
|
18
18
|
stream.on('end', () => resolve(data));
|
|
19
|
+
// Preserve the stream's original error object for callers.
|
|
20
|
+
// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors
|
|
19
21
|
stream.on('error', (error) => reject(error));
|
|
20
22
|
});
|
|
21
23
|
}
|
|
@@ -88,22 +90,20 @@ export function readConfig(options: CommandOptions): PartialConfig {
|
|
|
88
90
|
}
|
|
89
91
|
}
|
|
90
92
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
};
|
|
97
|
-
}
|
|
93
|
+
pc.input ??= {
|
|
94
|
+
files: [],
|
|
95
|
+
urls: [],
|
|
96
|
+
stdin: false,
|
|
97
|
+
};
|
|
98
98
|
if (options.files.length > 0) {
|
|
99
99
|
pc.input.files = options.files;
|
|
100
|
-
} else
|
|
101
|
-
pc.input.files
|
|
100
|
+
} else {
|
|
101
|
+
pc.input.files ??= [];
|
|
102
102
|
}
|
|
103
103
|
if (options.urls.length > 0) {
|
|
104
104
|
pc.input.urls = options.urls;
|
|
105
|
-
} else
|
|
106
|
-
pc.input.urls
|
|
105
|
+
} else {
|
|
106
|
+
pc.input.urls ??= [];
|
|
107
107
|
}
|
|
108
108
|
if (options.stdin != null) {
|
|
109
109
|
pc.input.stdin = options.stdin;
|
package/tsconfig.json
CHANGED
|
@@ -19,7 +19,6 @@
|
|
|
19
19
|
// "removeComments": true, /* Do not emit comments to output. */
|
|
20
20
|
// "noEmit": true, /* Do not emit outputs. */
|
|
21
21
|
"importHelpers": true, /* Import emit helpers from 'tslib'. */
|
|
22
|
-
"downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
|
23
22
|
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
|
24
23
|
|
|
25
24
|
/* Strict Type-Checking Options */
|
|
@@ -46,6 +45,7 @@
|
|
|
46
45
|
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
|
47
46
|
// "typeRoots": [], /* List of folders to include type definitions from. */
|
|
48
47
|
// "types": [], /* Type declaration files to be included in compilation. */
|
|
48
|
+
"types": ["node", "mocha"],
|
|
49
49
|
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
|
50
50
|
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
|
51
51
|
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
package/.eslintignore
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
/test/snapshots
|
package/.eslintrc.json
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"root": true,
|
|
3
|
-
"extends": [
|
|
4
|
-
"@dtsgenerator"
|
|
5
|
-
],
|
|
6
|
-
"rules": {
|
|
7
|
-
"@typescript-eslint/no-explicit-any": 0
|
|
8
|
-
},
|
|
9
|
-
"overrides": [
|
|
10
|
-
{
|
|
11
|
-
"files": [
|
|
12
|
-
"**/*_test.ts"
|
|
13
|
-
],
|
|
14
|
-
"rules": {
|
|
15
|
-
"@typescript-eslint/ban-ts-comment": 0,
|
|
16
|
-
"@typescript-eslint/no-empty-interface": 0,
|
|
17
|
-
"@typescript-eslint/no-explicit-any": 0,
|
|
18
|
-
"@typescript-eslint/no-floating-promises": 0,
|
|
19
|
-
"@typescript-eslint/no-implied-eval": 0,
|
|
20
|
-
"@typescript-eslint/no-misused-promises": 0,
|
|
21
|
-
"@typescript-eslint/no-unsafe-assignment": 0,
|
|
22
|
-
"@typescript-eslint/no-unsafe-call": 0,
|
|
23
|
-
"@typescript-eslint/no-unsafe-member-access": 0,
|
|
24
|
-
"@typescript-eslint/no-unsafe-return": 0,
|
|
25
|
-
"@typescript-eslint/no-var-requires": 0,
|
|
26
|
-
"@typescript-eslint/unbound-method": 0
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
]
|
|
30
|
-
}
|