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/dist/core/openApiV3.d.ts
CHANGED
|
@@ -12,19 +12,13 @@ export declare namespace OpenApisV3 {
|
|
|
12
12
|
}
|
|
13
13
|
namespace SchemaJson {
|
|
14
14
|
namespace Definitions {
|
|
15
|
-
|
|
16
|
-
[name: string]: any;
|
|
17
|
-
}
|
|
15
|
+
type Any = Record<string, any>;
|
|
18
16
|
type AnyOrExpression = Any | Expression;
|
|
19
|
-
|
|
20
|
-
[name: string]: AnyOrExpression;
|
|
21
|
-
}
|
|
17
|
+
type AnysOrExpressions = Record<string, AnyOrExpression>;
|
|
22
18
|
interface Callback {
|
|
23
19
|
}
|
|
24
20
|
type CallbackOrReference = Callback | Reference;
|
|
25
|
-
|
|
26
|
-
[name: string]: CallbackOrReference;
|
|
27
|
-
}
|
|
21
|
+
type CallbacksOrReferences = Record<string, CallbackOrReference>;
|
|
28
22
|
interface Components {
|
|
29
23
|
schemas?: SchemasOrReferences;
|
|
30
24
|
responses?: ResponsesOrReferences;
|
|
@@ -53,9 +47,7 @@ export declare namespace OpenApisV3 {
|
|
|
53
47
|
explode?: boolean;
|
|
54
48
|
allowReserved?: boolean;
|
|
55
49
|
}
|
|
56
|
-
|
|
57
|
-
[name: string]: Encoding;
|
|
58
|
-
}
|
|
50
|
+
type Encodings = Record<string, Encoding>;
|
|
59
51
|
interface Example {
|
|
60
52
|
summary?: string;
|
|
61
53
|
description?: string;
|
|
@@ -63,12 +55,8 @@ export declare namespace OpenApisV3 {
|
|
|
63
55
|
externalValue?: string;
|
|
64
56
|
}
|
|
65
57
|
type ExampleOrReference = Example | Reference;
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
}
|
|
69
|
-
interface Expression {
|
|
70
|
-
[name: string]: any;
|
|
71
|
-
}
|
|
58
|
+
type ExamplesOrReferences = Record<string, ExampleOrReference>;
|
|
59
|
+
type Expression = Record<string, any>;
|
|
72
60
|
interface ExternalDocs {
|
|
73
61
|
description?: string;
|
|
74
62
|
url: string;
|
|
@@ -87,9 +75,7 @@ export declare namespace OpenApisV3 {
|
|
|
87
75
|
content?: MediaTypes;
|
|
88
76
|
}
|
|
89
77
|
type HeaderOrReference = Header | Reference;
|
|
90
|
-
|
|
91
|
-
[name: string]: HeaderOrReference;
|
|
92
|
-
}
|
|
78
|
+
type HeadersOrReferences = Record<string, HeaderOrReference>;
|
|
93
79
|
interface Info {
|
|
94
80
|
title: string;
|
|
95
81
|
description?: string;
|
|
@@ -111,18 +97,14 @@ export declare namespace OpenApisV3 {
|
|
|
111
97
|
server?: Server;
|
|
112
98
|
}
|
|
113
99
|
type LinkOrReference = Link | Reference;
|
|
114
|
-
|
|
115
|
-
[name: string]: LinkOrReference;
|
|
116
|
-
}
|
|
100
|
+
type LinksOrReferences = Record<string, LinkOrReference>;
|
|
117
101
|
interface MediaType {
|
|
118
102
|
schema?: SchemaOrReference;
|
|
119
103
|
example?: Any;
|
|
120
104
|
examples?: ExamplesOrReferences;
|
|
121
105
|
encoding?: Encodings;
|
|
122
106
|
}
|
|
123
|
-
|
|
124
|
-
[name: string]: MediaType;
|
|
125
|
-
}
|
|
107
|
+
type MediaTypes = Record<string, MediaType>;
|
|
126
108
|
interface OauthFlow {
|
|
127
109
|
authorizationUrl?: string;
|
|
128
110
|
tokenUrl?: string;
|
|
@@ -165,9 +147,7 @@ export declare namespace OpenApisV3 {
|
|
|
165
147
|
content?: MediaTypes;
|
|
166
148
|
}
|
|
167
149
|
type ParameterOrReference = Parameter | Reference;
|
|
168
|
-
|
|
169
|
-
[name: string]: ParameterOrReference;
|
|
170
|
-
}
|
|
150
|
+
type ParametersOrReferences = Record<string, ParameterOrReference>;
|
|
171
151
|
interface PathItem {
|
|
172
152
|
$ref?: string;
|
|
173
153
|
summary?: string;
|
|
@@ -184,15 +164,11 @@ export declare namespace OpenApisV3 {
|
|
|
184
164
|
parameters?: ParameterOrReference[];
|
|
185
165
|
}
|
|
186
166
|
type PathItemOrReference = PathItem | Reference;
|
|
187
|
-
|
|
188
|
-
[name: string]: PathItemOrReference;
|
|
189
|
-
}
|
|
167
|
+
type Paths = Record<string, PathItemOrReference>;
|
|
190
168
|
interface Reference {
|
|
191
169
|
$ref: string;
|
|
192
170
|
}
|
|
193
|
-
|
|
194
|
-
[name: string]: RequestBodyOrReference;
|
|
195
|
-
}
|
|
171
|
+
type RequestBodiesOrReferences = Record<string, RequestBodyOrReference>;
|
|
196
172
|
interface RequestBody {
|
|
197
173
|
description?: string;
|
|
198
174
|
content: MediaTypes;
|
|
@@ -206,13 +182,9 @@ export declare namespace OpenApisV3 {
|
|
|
206
182
|
links?: LinksOrReferences;
|
|
207
183
|
}
|
|
208
184
|
type ResponseOrReference = Response | Reference;
|
|
209
|
-
|
|
210
|
-
[name: string]: ResponseOrReference;
|
|
211
|
-
}
|
|
185
|
+
type ResponsesOrReferences = Record<string, ResponseOrReference>;
|
|
212
186
|
type SchemaOrReference = JsonSchemaDraft07.SchemaObject | Reference;
|
|
213
|
-
|
|
214
|
-
[name: string]: SchemaOrReference;
|
|
215
|
-
}
|
|
187
|
+
type SchemasOrReferences = Record<string, SchemaOrReference>;
|
|
216
188
|
interface SecurityRequirement {
|
|
217
189
|
}
|
|
218
190
|
interface SecurityScheme {
|
|
@@ -226,9 +198,7 @@ export declare namespace OpenApisV3 {
|
|
|
226
198
|
openIdConnectUrl?: string;
|
|
227
199
|
}
|
|
228
200
|
type SecuritySchemeOrReference = SecurityScheme | Reference;
|
|
229
|
-
|
|
230
|
-
[name: string]: SecuritySchemeOrReference;
|
|
231
|
-
}
|
|
201
|
+
type SecuritySchemesOrReferences = Record<string, SecuritySchemeOrReference>;
|
|
232
202
|
interface Server {
|
|
233
203
|
url: string;
|
|
234
204
|
description?: string;
|
|
@@ -239,13 +209,9 @@ export declare namespace OpenApisV3 {
|
|
|
239
209
|
default: string;
|
|
240
210
|
description?: string;
|
|
241
211
|
}
|
|
242
|
-
|
|
243
|
-
[name: string]: ServerVariable;
|
|
244
|
-
}
|
|
212
|
+
type ServerVariables = Record<string, ServerVariable>;
|
|
245
213
|
type SpecificationExtension = null | number | boolean | string | any[];
|
|
246
|
-
|
|
247
|
-
[name: string]: string;
|
|
248
|
-
}
|
|
214
|
+
type Strings = Record<string, string>;
|
|
249
215
|
interface Tag {
|
|
250
216
|
name: string;
|
|
251
217
|
description?: string;
|
package/dist/core/schemaId.d.ts
CHANGED
package/dist/core/type.d.ts
CHANGED
|
@@ -27,7 +27,7 @@ export interface PluginContext {
|
|
|
27
27
|
inputSchemas: IterableIterator<[string, Schema]>;
|
|
28
28
|
}
|
|
29
29
|
export type PreProcessHandler = (contents: Schema[]) => Schema[];
|
|
30
|
-
export
|
|
30
|
+
export interface Plugin {
|
|
31
31
|
meta: {
|
|
32
32
|
name: string;
|
|
33
33
|
version: string;
|
|
@@ -35,5 +35,5 @@ export type Plugin = {
|
|
|
35
35
|
};
|
|
36
36
|
preProcess?: (context: PluginContext) => Promise<PreProcessHandler | undefined>;
|
|
37
37
|
postProcess?: (context: PluginContext) => Promise<TransformerFactory<SourceFile> | undefined>;
|
|
38
|
-
}
|
|
38
|
+
}
|
|
39
39
|
export declare function loadPlugin(name: string, option: boolean | Record<string, unknown>): Promise<Plugin | undefined>;
|
package/dist/core/type.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.isJsonSchemaDraft04 = isJsonSchemaDraft04;
|
|
4
|
+
exports.parseSchema = parseSchema;
|
|
5
|
+
exports.readSchemaFromStdin = readSchemaFromStdin;
|
|
6
|
+
exports.readSchemasFromFile = readSchemasFromFile;
|
|
7
|
+
exports.readSchemaFromUrl = readSchemaFromUrl;
|
|
8
|
+
exports.parseFileContent = parseFileContent;
|
|
9
|
+
exports.loadPlugin = loadPlugin;
|
|
4
10
|
const tslib_1 = require("tslib");
|
|
5
11
|
const fs = tslib_1.__importStar(require("fs"));
|
|
6
12
|
const path_1 = require("path");
|
|
@@ -12,7 +18,6 @@ exports.ts = require("typescript");
|
|
|
12
18
|
function isJsonSchemaDraft04(_content, type) {
|
|
13
19
|
return type === 'Draft04';
|
|
14
20
|
}
|
|
15
|
-
exports.isJsonSchemaDraft04 = isJsonSchemaDraft04;
|
|
16
21
|
function parseSchema(content, url) {
|
|
17
22
|
const { type, openApiVersion } = (0, jsonSchema_1.selectSchemaType)(content);
|
|
18
23
|
let id;
|
|
@@ -29,13 +34,11 @@ function parseSchema(content, url) {
|
|
|
29
34
|
content,
|
|
30
35
|
};
|
|
31
36
|
}
|
|
32
|
-
exports.parseSchema = parseSchema;
|
|
33
37
|
async function readSchemaFromStdin() {
|
|
34
38
|
const data = await (0, utils_1.readStream)(process.stdin);
|
|
35
39
|
const content = parseFileContent(data);
|
|
36
40
|
return parseSchema(content);
|
|
37
41
|
}
|
|
38
|
-
exports.readSchemaFromStdin = readSchemaFromStdin;
|
|
39
42
|
async function readSchemasFromFile(pattern) {
|
|
40
43
|
const files = await (0, utils_1.globFiles)(pattern);
|
|
41
44
|
return Promise.all(files.map(async (file) => {
|
|
@@ -46,13 +49,11 @@ async function readSchemasFromFile(pattern) {
|
|
|
46
49
|
return parseSchema(content);
|
|
47
50
|
}));
|
|
48
51
|
}
|
|
49
|
-
exports.readSchemasFromFile = readSchemasFromFile;
|
|
50
52
|
async function readSchemaFromUrl(url) {
|
|
51
53
|
const data = await (0, utils_1.readUrl)(url);
|
|
52
54
|
const content = parseFileContent(data, url);
|
|
53
55
|
return parseSchema(content, url);
|
|
54
56
|
}
|
|
55
|
-
exports.readSchemaFromUrl = readSchemaFromUrl;
|
|
56
57
|
function parseFileContent(content, filename) {
|
|
57
58
|
const ext = filename ? (0, path_1.extname)(filename).toLowerCase() : '';
|
|
58
59
|
const maybeYaml = ext === '.yaml' || ext === '.yml';
|
|
@@ -73,7 +74,6 @@ function parseFileContent(content, filename) {
|
|
|
73
74
|
}
|
|
74
75
|
}
|
|
75
76
|
}
|
|
76
|
-
exports.parseFileContent = parseFileContent;
|
|
77
77
|
function deepCopy(obj) {
|
|
78
78
|
return JSON.parse(JSON.stringify(obj));
|
|
79
79
|
}
|
|
@@ -98,4 +98,3 @@ async function loadPlugin(name, option) {
|
|
|
98
98
|
}
|
|
99
99
|
return plugin;
|
|
100
100
|
}
|
|
101
|
-
exports.loadPlugin = loadPlugin;
|
package/dist/core/typeTree.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildTypeTree =
|
|
3
|
+
exports.buildTypeTree = buildTypeTree;
|
|
4
4
|
function buildTypeTree(schemas) {
|
|
5
5
|
const tree = buildTree();
|
|
6
6
|
for (const type of schemas) {
|
|
@@ -11,7 +11,6 @@ function buildTypeTree(schemas) {
|
|
|
11
11
|
}
|
|
12
12
|
return tree;
|
|
13
13
|
}
|
|
14
|
-
exports.buildTypeTree = buildTypeTree;
|
|
15
14
|
function setTypeToTree(tree, paths, type) {
|
|
16
15
|
if (paths.length === 0) {
|
|
17
16
|
throw new Error('The paths is nothing for set the type to TypeTree.');
|
package/dist/core/utils.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.toTSType = toTSType;
|
|
4
|
+
exports.reduceTypes = reduceTypes;
|
|
5
|
+
exports.checkValidMIMEType = checkValidMIMEType;
|
|
6
|
+
exports.mergeSchema = mergeSchema;
|
|
4
7
|
const tslib_1 = require("tslib");
|
|
5
8
|
const debug_1 = tslib_1.__importDefault(require("debug"));
|
|
6
9
|
const ts = tslib_1.__importStar(require("typescript"));
|
|
@@ -33,7 +36,6 @@ function toTSType(type, debugSource) {
|
|
|
33
36
|
throw new Error('unknown type: ' + type);
|
|
34
37
|
}
|
|
35
38
|
}
|
|
36
|
-
exports.toTSType = toTSType;
|
|
37
39
|
function reduceTypes(types) {
|
|
38
40
|
if (types.length < 2) {
|
|
39
41
|
return types;
|
|
@@ -41,7 +43,6 @@ function reduceTypes(types) {
|
|
|
41
43
|
const set = new Set(types);
|
|
42
44
|
return Array.from(set.values());
|
|
43
45
|
}
|
|
44
|
-
exports.reduceTypes = reduceTypes;
|
|
45
46
|
function checkValidMIMEType(mime) {
|
|
46
47
|
var _a;
|
|
47
48
|
const type = (_a = mime.toLowerCase().split(';')[0]) === null || _a === void 0 ? void 0 : _a.trim();
|
|
@@ -62,7 +63,6 @@ function checkValidMIMEType(mime) {
|
|
|
62
63
|
}
|
|
63
64
|
return /^application\/(?:[a-z0-9-_.]+\+)?json5?$/.test(type);
|
|
64
65
|
}
|
|
65
|
-
exports.checkValidMIMEType = checkValidMIMEType;
|
|
66
66
|
function mergeSchema(a, b) {
|
|
67
67
|
if ('$ref' in a || '$ref' in b) {
|
|
68
68
|
a.$ref = b.$ref || a.$ref;
|
|
@@ -87,4 +87,3 @@ function mergeSchema(a, b) {
|
|
|
87
87
|
});
|
|
88
88
|
return true;
|
|
89
89
|
}
|
|
90
|
-
exports.mergeSchema = mergeSchema;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.checkInvalidCharacter = checkInvalidCharacter;
|
|
4
|
+
exports.toValidIdentifier = toValidIdentifier;
|
|
5
|
+
exports.toTypeName = toTypeName;
|
|
4
6
|
const typescript_1 = require("typescript");
|
|
5
7
|
function checkInvalidCharacter(text, target) {
|
|
6
8
|
const firstCharCode = text.charCodeAt(0);
|
|
@@ -15,7 +17,6 @@ function checkInvalidCharacter(text, target) {
|
|
|
15
17
|
}
|
|
16
18
|
return true;
|
|
17
19
|
}
|
|
18
|
-
exports.checkInvalidCharacter = checkInvalidCharacter;
|
|
19
20
|
function toValidIdentifier(text, target) {
|
|
20
21
|
if (/^\d/.test(text)) {
|
|
21
22
|
text = '$' + text;
|
|
@@ -43,7 +44,6 @@ function toValidIdentifier(text, target) {
|
|
|
43
44
|
}
|
|
44
45
|
return res || '_';
|
|
45
46
|
}
|
|
46
|
-
exports.toValidIdentifier = toValidIdentifier;
|
|
47
47
|
function toTypeName(text, target) {
|
|
48
48
|
if (/^\d/.test(text)) {
|
|
49
49
|
text = '$' + text;
|
|
@@ -75,7 +75,6 @@ function toTypeName(text, target) {
|
|
|
75
75
|
}
|
|
76
76
|
return res || '_';
|
|
77
77
|
}
|
|
78
|
-
exports.toTypeName = toTypeName;
|
|
79
78
|
const unicodeES3IdentifierStart = [
|
|
80
79
|
170, 170, 181, 181, 186, 186, 192, 214, 216, 246, 248, 543, 546, 563, 592,
|
|
81
80
|
685, 688, 696, 699, 705, 720, 721, 736, 740, 750, 750, 890, 890, 902, 902,
|
package/dist/jsonPointer.js
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.get = get;
|
|
4
|
+
exports.set = set;
|
|
5
|
+
exports.parse = parse;
|
|
6
|
+
exports.tilde = tilde;
|
|
4
7
|
function get(obj, path, isCreateOnNotExists = false) {
|
|
5
8
|
if (path.length === 0) {
|
|
6
9
|
return obj;
|
|
@@ -23,7 +26,6 @@ function get(obj, path, isCreateOnNotExists = false) {
|
|
|
23
26
|
}
|
|
24
27
|
return o[lastKey];
|
|
25
28
|
}
|
|
26
|
-
exports.get = get;
|
|
27
29
|
function set(obj, path, value) {
|
|
28
30
|
if (path.length === 0) {
|
|
29
31
|
return;
|
|
@@ -41,7 +43,6 @@ function set(obj, path, value) {
|
|
|
41
43
|
}
|
|
42
44
|
o[lastKey] = value;
|
|
43
45
|
}
|
|
44
|
-
exports.set = set;
|
|
45
46
|
function parse(s) {
|
|
46
47
|
if (s.startsWith('#')) {
|
|
47
48
|
s = s.substring(1);
|
|
@@ -52,7 +53,6 @@ function parse(s) {
|
|
|
52
53
|
}
|
|
53
54
|
return path.map((key) => untilde(key));
|
|
54
55
|
}
|
|
55
|
-
exports.parse = parse;
|
|
56
56
|
function untilde(key) {
|
|
57
57
|
return key.replace(/~(0|1)/g, (match) => {
|
|
58
58
|
switch (match) {
|
|
@@ -68,4 +68,3 @@ function untilde(key) {
|
|
|
68
68
|
function tilde(key) {
|
|
69
69
|
return key.replace(/~/, '~0').replace(/\//g, '~1');
|
|
70
70
|
}
|
|
71
|
-
exports.tilde = tilde;
|
package/dist/utils.d.ts
CHANGED
package/dist/utils.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.readStream = readStream;
|
|
4
|
+
exports.readUrl = readUrl;
|
|
5
|
+
exports.buildProxyOptions = buildProxyOptions;
|
|
6
|
+
exports.globFiles = globFiles;
|
|
7
|
+
exports.readConfig = readConfig;
|
|
4
8
|
const tslib_1 = require("tslib");
|
|
5
9
|
const fs = tslib_1.__importStar(require("fs"));
|
|
6
10
|
const url_1 = require("url");
|
|
@@ -18,7 +22,6 @@ function readStream(stream, encoding = 'utf8') {
|
|
|
18
22
|
stream.on('error', (error) => reject(error));
|
|
19
23
|
});
|
|
20
24
|
}
|
|
21
|
-
exports.readStream = readStream;
|
|
22
25
|
async function readUrl(url) {
|
|
23
26
|
const init = buildProxyOptions(url);
|
|
24
27
|
const res = await fetch(url, init);
|
|
@@ -28,7 +31,6 @@ async function readUrl(url) {
|
|
|
28
31
|
}
|
|
29
32
|
return data;
|
|
30
33
|
}
|
|
31
|
-
exports.readUrl = readUrl;
|
|
32
34
|
function noProxy(url) {
|
|
33
35
|
if (process.env.NO_PROXY) {
|
|
34
36
|
for (const domain of process.env.NO_PROXY.split(/[, ]+/)) {
|
|
@@ -55,7 +57,6 @@ function buildProxyOptions(url) {
|
|
|
55
57
|
}
|
|
56
58
|
return undefined;
|
|
57
59
|
}
|
|
58
|
-
exports.buildProxyOptions = buildProxyOptions;
|
|
59
60
|
async function globFiles(pattern, options) {
|
|
60
61
|
const result = [];
|
|
61
62
|
for await (const r of (0, glob_1.globIterate)(pattern, options !== null && options !== void 0 ? options : {})) {
|
|
@@ -68,9 +69,9 @@ async function globFiles(pattern, options) {
|
|
|
68
69
|
}
|
|
69
70
|
return result;
|
|
70
71
|
}
|
|
71
|
-
exports.globFiles = globFiles;
|
|
72
72
|
function readConfig(options) {
|
|
73
|
-
var _a;
|
|
73
|
+
var _a, _b, _c, _d;
|
|
74
|
+
var _e, _f;
|
|
74
75
|
let pc = {};
|
|
75
76
|
const configFile = (_a = options.configFile) !== null && _a !== void 0 ? _a : commandOptions_1.defaultConfigFile;
|
|
76
77
|
try {
|
|
@@ -82,24 +83,22 @@ function readConfig(options) {
|
|
|
82
83
|
console.error('Error to load config file from ' + options.configFile);
|
|
83
84
|
}
|
|
84
85
|
}
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
};
|
|
91
|
-
}
|
|
86
|
+
(_b = pc.input) !== null && _b !== void 0 ? _b : (pc.input = {
|
|
87
|
+
files: [],
|
|
88
|
+
urls: [],
|
|
89
|
+
stdin: false,
|
|
90
|
+
});
|
|
92
91
|
if (options.files.length > 0) {
|
|
93
92
|
pc.input.files = options.files;
|
|
94
93
|
}
|
|
95
|
-
else
|
|
96
|
-
pc.input.files = [];
|
|
94
|
+
else {
|
|
95
|
+
(_c = (_e = pc.input).files) !== null && _c !== void 0 ? _c : (_e.files = []);
|
|
97
96
|
}
|
|
98
97
|
if (options.urls.length > 0) {
|
|
99
98
|
pc.input.urls = options.urls;
|
|
100
99
|
}
|
|
101
|
-
else
|
|
102
|
-
pc.input.urls = [];
|
|
100
|
+
else {
|
|
101
|
+
(_d = (_f = pc.input).urls) !== null && _d !== void 0 ? _d : (_f.urls = []);
|
|
103
102
|
}
|
|
104
103
|
if (options.stdin != null) {
|
|
105
104
|
pc.input.stdin = options.stdin;
|
|
@@ -121,7 +120,6 @@ function readConfig(options) {
|
|
|
121
120
|
pc.outputAST = !!options.outputAST;
|
|
122
121
|
return pc;
|
|
123
122
|
}
|
|
124
|
-
exports.readConfig = readConfig;
|
|
125
123
|
function loadJSON(file) {
|
|
126
124
|
const content = fs.readFileSync(file, 'utf-8');
|
|
127
125
|
return JSON.parse(content);
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
# Dependency modernization
|
|
2
|
+
|
|
3
|
+
## Scope and responsibilities
|
|
4
|
+
|
|
5
|
+
Update `horiuchi/dtsgenerator` and the six repositories under the `dtsgenerator`
|
|
6
|
+
organization: `eslint-config`, `do-nothing`, `replace-namespace`, `single-quote`,
|
|
7
|
+
`decorate-typename`, and `create`, including the latter's generated templates.
|
|
8
|
+
|
|
9
|
+
Astra specifies the changes, coordinates implementation, reviews the resulting
|
|
10
|
+
diffs, and verifies integration. Sol and Luna implement the changes.
|
|
11
|
+
|
|
12
|
+
## Compatibility requirements
|
|
13
|
+
|
|
14
|
+
- Support Node.js 22 and 24. The common engine range is
|
|
15
|
+
`^22.22.2 || >=24.15.0`, accommodating the latest package-name validator and
|
|
16
|
+
development tools. CI tests both supported LTS lines.
|
|
17
|
+
- Preserve generated declarations byte for byte, including whitespace, comments,
|
|
18
|
+
ordering, quoting, and namespace transformations. Existing snapshots must not
|
|
19
|
+
be regenerated to hide dependency-induced differences.
|
|
20
|
+
- Preserve CLI options, stdin/file/URL inputs, help output, exit behavior,
|
|
21
|
+
configuration precedence, and public CommonJS entry points.
|
|
22
|
+
- Preserve plugin pre/post-processing contracts and the public `ts` re-export.
|
|
23
|
+
- Retain centralized lint rules in `@dtsgenerator/eslint-config`; consumer files
|
|
24
|
+
contain only project-specific configuration and exceptions.
|
|
25
|
+
- Preserve existing unrelated working-tree changes.
|
|
26
|
+
|
|
27
|
+
## Dependency selection
|
|
28
|
+
|
|
29
|
+
Use current stable versions compatible with the above contracts, updating the
|
|
30
|
+
lockfiles as well as manifest ranges. Registry metadata was checked on
|
|
31
|
+
2026-09-08. Do not use `--force` or `--legacy-peer-deps` to bypass incompatibility.
|
|
32
|
+
|
|
33
|
+
TypeScript 7.0.2 is the current latest release, but does not provide the Compiler
|
|
34
|
+
API required by this library and its plugins. Use the current JavaScript API
|
|
35
|
+
release, `typescript@^6.0.3`, consistently across the ecosystem. The published
|
|
36
|
+
`@typescript/typescript6` compatibility wrapper is unnecessary while the regular
|
|
37
|
+
6.x package remains available. Keep `@types/node` on the latest 22.x release to
|
|
38
|
+
avoid accidentally relying on APIs missing from the lower supported runtime.
|
|
39
|
+
|
|
40
|
+
Keep the runtime YAML parser on `js-yaml@^4.3.2`, the current compatible 4.x
|
|
41
|
+
release. Version 5.4.1 changes the default schema: merge keys stop expanding and
|
|
42
|
+
timestamps stop becoming Dates (and therefore ISO strings after the existing
|
|
43
|
+
deep-copy step). Its YAML 1.1 schema is not a drop-in replacement either: scalar
|
|
44
|
+
syntax, sets, and complex mapping keys differ. Reimplementing the old parser's
|
|
45
|
+
semantics would exceed this behavior-preserving update. Regression tests cover
|
|
46
|
+
the observed merge and timestamp cases. A 5.x parser used internally by updated
|
|
47
|
+
development tools does not change this library's runtime parser selection.
|
|
48
|
+
|
|
49
|
+
The shared ESLint package migrates to a CommonJS-exported flat-config array.
|
|
50
|
+
Consumers spread that array and append their overrides. Parser project discovery
|
|
51
|
+
must work from each consumer's tsconfig. Retired rules are replaced by equivalent
|
|
52
|
+
rules or explicit compatibility settings; dependency updates must not cause
|
|
53
|
+
unrelated semantic refactors. New `lint`/format checks are separated from commands
|
|
54
|
+
that intentionally fix files, so verification cannot rewrite source code.
|
|
55
|
+
|
|
56
|
+
## Implementation sequence
|
|
57
|
+
|
|
58
|
+
1. Capture the existing build/test results in isolated copies. Distinguish
|
|
59
|
+
installation or external-service failures from update regressions.
|
|
60
|
+
2. Modernize and test the shared ESLint package using actual TypeScript fixtures.
|
|
61
|
+
3. Update the main package and four plugins, including CI, release workflows,
|
|
62
|
+
Husky invocation, compiler configuration, and necessary compatibility edits.
|
|
63
|
+
4. Update `create` and its templates; generate a fresh project and verify the
|
|
64
|
+
generated package, lint, build, tests, and hooks.
|
|
65
|
+
5. Test both published dependency contracts and the locally packed updated
|
|
66
|
+
packages together before reflecting reviewed changes into the source repos.
|
|
67
|
+
|
|
68
|
+
## Acceptance checks
|
|
69
|
+
|
|
70
|
+
- Clean installation from the intended dependency graph; no invalid peers.
|
|
71
|
+
- Build/type checks, lint checks, and existing test/coverage commands on Node.js
|
|
72
|
+
22 and 24, with exact pass/fail/skip counts recorded.
|
|
73
|
+
- Existing generated-output snapshots remain unchanged.
|
|
74
|
+
- Focused tests for actual dependency migration risks, particularly CLI parsing,
|
|
75
|
+
YAML semantics, file matching, URL handling, and plugin transformations.
|
|
76
|
+
- Pack/install smoke tests load the CommonJS API and execute the CLI.
|
|
77
|
+
- All four updated plugins run against the updated main package, not merely the
|
|
78
|
+
previously published package accidentally resolved from npm.
|
|
79
|
+
- A freshly generated plugin can install, lint, build, and test.
|
|
80
|
+
- CI uses the lockfile reproducibly via `npm ci`, with no subsequent unpinned
|
|
81
|
+
global npm update or redundant `npm install`.
|
|
82
|
+
|
|
83
|
+
## Release boundary
|
|
84
|
+
|
|
85
|
+
No tags are pushed as part of this change. `eslint-config` targeted 1.0.0
|
|
86
|
+
because its configuration interface changes. `do-nothing` originally targeted
|
|
87
|
+
3.0.0: its published 2.6.0 package requires exactly
|
|
88
|
+
`dtsgenerator@3.19.0`, while the local repository already declares 3.19.2. The
|
|
89
|
+
published peer constraint conflicts with the other test plugins and prevents a
|
|
90
|
+
clean baseline installation. The corrected contract was published as 3.0.1
|
|
91
|
+
rather than overriding an incompatible peer or reusing published metadata.
|
|
92
|
+
Other package version fields remain unchanged pending a coordinated release;
|
|
93
|
+
dropping old Node.js support must be called out when selecting release versions.
|
|
94
|
+
|
|
95
|
+
Consumers' normal dependency ranges target the new shared configuration release.
|
|
96
|
+
Before that release is published, integration checks must install its locally
|
|
97
|
+
packed artifact in a temporary validation environment. Do not commit temporary
|
|
98
|
+
absolute paths, localhost registry addresses, or pretend that an unpublished
|
|
99
|
+
artifact was downloaded from the public registry. The main package also needs the
|
|
100
|
+
new `do-nothing` artifact. The release notes must identify
|
|
101
|
+
any installation prerequisite and the exact validation method used.
|
|
102
|
+
|
|
103
|
+
After publishing each prerequisite package, refresh every consumer lockfile entry
|
|
104
|
+
for that exact package from the artifact actually served by the public registry.
|
|
105
|
+
Confirm that its version, dependency and peer metadata match the package being
|
|
106
|
+
released, and that its `resolved` URL and `integrity` match the downloaded artifact
|
|
107
|
+
and published `dist` metadata. Then run `npm ci` from a fresh cache in an isolated
|
|
108
|
+
copy. A locally packed artifact
|
|
109
|
+
may be used for pre-release integration testing, but its integrity must not be
|
|
110
|
+
copied into a registry URL entry, and preloading it into an npm cache does not
|
|
111
|
+
count as a public-registry installation check. As of 2026-09-18,
|
|
112
|
+
`@dtsgenerator/eslint-config@1.0.0` and `@dtsgenerator/do-nothing@3.0.1` are
|
|
113
|
+
published, and the consumer lockfiles have been refreshed from the public
|
|
114
|
+
registry artifacts. The main lockfile entry for `do-nothing` records the
|
|
115
|
+
published tarball URL and integrity.
|
|
116
|
+
|
|
117
|
+
The main repository's test-plugin peers also cause npm to install the published
|
|
118
|
+
`dtsgenerator@3.19.2` as a development dependency, with its older transitive
|
|
119
|
+
dependencies (including TypeScript 5). This is distinct from the updated main
|
|
120
|
+
package's runtime graph. Standard repository tests therefore do not alone prove
|
|
121
|
+
that plugins use the updated main package or its TypeScript instance. A separate
|
|
122
|
+
consumer installs the locally packed updated main and all four updated plugins,
|
|
123
|
+
then runs their actual snapshot suites against that single installed main.
|
|
124
|
+
Future coordinated version bumps must update these peer/development ranges
|
|
125
|
+
together; do not remove this distinction by masking peer conflicts.
|
|
126
|
+
|
|
127
|
+
## Baseline evidence
|
|
128
|
+
|
|
129
|
+
The untouched working-tree source was built with the existing installed
|
|
130
|
+
dependencies in an isolated directory. Node.js 22.23.2 and 24.20.0 each produced
|
|
131
|
+
186 passing tests and one failing test. All 26 declaration-generation snapshots
|
|
132
|
+
passed. The failing assertion hard-codes older plugin version strings in the
|
|
133
|
+
configuration information output; it must be updated to verify the same format
|
|
134
|
+
using the installed package metadata.
|
|
135
|
+
|
|
136
|
+
Two setup limitations were isolated: the original lockfile cannot be cleanly
|
|
137
|
+
installed due to the published `do-nothing` peer conflict described above, and
|
|
138
|
+
plugins need the built main package resolvable from their module search path.
|
|
139
|
+
Baseline verification used the existing dependencies and an isolated `NODE_PATH`
|
|
140
|
+
mapping to the built baseline package. Network access was enabled for the existing
|
|
141
|
+
external JSON Schema references. These results do not claim a successful baseline
|
|
142
|
+
`npm ci`.
|
|
143
|
+
|
|
144
|
+
## Verification results
|
|
145
|
+
|
|
146
|
+
Verified with Node.js 22.23.2 and 24.20.0:
|
|
147
|
+
|
|
148
|
+
| Package / scenario | Result on each runtime |
|
|
149
|
+
| --- | --- |
|
|
150
|
+
| Main package | Build, lint, format, 189 tests, coverage report pass; 93.21% line coverage |
|
|
151
|
+
| Shared ESLint config | Configuration inspection and real TypeScript fixtures pass |
|
|
152
|
+
| `do-nothing` | Build, lint, format, 4 tests and coverage pass |
|
|
153
|
+
| `replace-namespace` | Build, lint, format, 3 tests and coverage pass |
|
|
154
|
+
| `single-quote` | Build, lint, format, 1 test and coverage pass |
|
|
155
|
+
| `decorate-typename` | Build, lint, format, 2 tests and coverage pass |
|
|
156
|
+
| `create` CLI | 7 tests pass, including help, argument errors, naming and existing directories |
|
|
157
|
+
| Freshly generated plugin | Install, format, lint, build and 4 tests pass; 100% coverage |
|
|
158
|
+
|
|
159
|
+
All 40 pre-existing expected fixture files across the seven repositories are
|
|
160
|
+
byte-identical. All 19 public declaration files emitted by the main package are
|
|
161
|
+
also byte-identical to the baseline. Additional comparisons confirmed identical
|
|
162
|
+
declarations and AST JSON for object, array and union schemas, and identical YAML
|
|
163
|
+
parsing for merge keys, timestamps, scalar values, sets and complex keys.
|
|
164
|
+
|
|
165
|
+
The generated project's actual Git configuration points `core.hooksPath` to
|
|
166
|
+
`.husky/_`. Test-only npm wrappers supply local package artifacts during generated
|
|
167
|
+
project integration; the production CLI has no new environment-variable switches
|
|
168
|
+
for skipping installation or overriding its dependency specifications.
|
|
169
|
+
|
|
170
|
+
Before the prerequisite releases, integration was checked using ordinary manifest
|
|
171
|
+
ranges and registry URLs in the lockfiles, with the exact unpublished artifacts
|
|
172
|
+
first added to an isolated npm cache. `npm ls --all` checked the resulting
|
|
173
|
+
dependency graph. This was a pre-release graph check, not a successful
|
|
174
|
+
public-registry-only installation. For the main package, npm regenerated the final
|
|
175
|
+
lockfile after changing local artifact specs back to normal ranges, ensuring the
|
|
176
|
+
published main package required by test-plugin peers and its transitive
|
|
177
|
+
dependencies are recorded as well.
|
|
178
|
+
|
|
179
|
+
These checks did not mean that a fresh public-registry-only install was possible
|
|
180
|
+
before the prerequisite packages were published. After each publication, the
|
|
181
|
+
consumer lockfiles and fresh-cache `npm ci` result must be verified again against
|
|
182
|
+
the public registry. GitHub Actions workflows were updated but had not been
|
|
183
|
+
executed on GitHub as part of the original local verification.
|
|
184
|
+
|
|
185
|
+
Sources: [TypeScript 7 announcement](https://devblogs.microsoft.com/typescript/announcing-typescript-7-0/),
|
|
186
|
+
[ESLint 10 migration](https://eslint.org/docs/latest/use/migrate-to-10.0.0),
|
|
187
|
+
[js-yaml 5 migration](https://github.com/nodeca/js-yaml/blob/master/docs/migrate_v4_to_v5.md),
|
|
188
|
+
[Node.js releases](https://nodejs.org/en/about/previous-releases), and the npm
|
|
189
|
+
registry metadata for each selected version.
|