ts-class-to-openapi 1.3.3 → 1.3.4
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.cjs +2 -11
- package/dist/index.mjs +2 -11
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -188,9 +188,6 @@ var SchemaTransformer = class SchemaTransformer {
|
|
|
188
188
|
classCache = /* @__PURE__ */ new WeakMap();
|
|
189
189
|
maxCacheSize;
|
|
190
190
|
autoCleanup;
|
|
191
|
-
loadedFiles = /* @__PURE__ */ new Set();
|
|
192
|
-
processingClasses = /* @__PURE__ */ new Set();
|
|
193
|
-
sourceFiles;
|
|
194
191
|
classFileIndex = /* @__PURE__ */ new Map();
|
|
195
192
|
constructor(tsConfigPath = constants.TS_CONFIG_DEFAULT_PATH, options = {}) {
|
|
196
193
|
this.maxCacheSize = options.maxCacheSize ?? 100;
|
|
@@ -203,13 +200,7 @@ var SchemaTransformer = class SchemaTransformer {
|
|
|
203
200
|
const { options: tsOptions, fileNames } = typescript.default.parseJsonConfigFileContent(config, typescript.default.sys, "./");
|
|
204
201
|
this.program = typescript.default.createProgram(fileNames, tsOptions);
|
|
205
202
|
this.checker = this.program.getTypeChecker();
|
|
206
|
-
this.
|
|
207
|
-
if (sf.isDeclarationFile) return false;
|
|
208
|
-
if (sf.fileName.includes(".d.ts")) return false;
|
|
209
|
-
if (sf.fileName.includes("node_modules")) return false;
|
|
210
|
-
return true;
|
|
211
|
-
});
|
|
212
|
-
this.sourceFiles.forEach((sf) => {
|
|
203
|
+
this.program.getSourceFiles().forEach((sf) => {
|
|
213
204
|
sf.statements.forEach((stmt) => {
|
|
214
205
|
if (typescript.default.isClassDeclaration(stmt) && stmt.name) {
|
|
215
206
|
const name = stmt.name.text;
|
|
@@ -556,7 +547,7 @@ var SchemaTransformer = class SchemaTransformer {
|
|
|
556
547
|
if (sourceOptions === null || sourceOptions === void 0 ? void 0 : sourceOptions.isExternal) return this.program.getSourceFiles().filter((sf) => {
|
|
557
548
|
return sf.fileName.includes(sourceOptions.packageName) && (!sourceOptions.filePath || sf.fileName === sourceOptions.filePath);
|
|
558
549
|
});
|
|
559
|
-
return this.
|
|
550
|
+
return this.program.getSourceFiles().filter((sf) => {
|
|
560
551
|
if ((sourceOptions === null || sourceOptions === void 0 ? void 0 : sourceOptions.filePath) && !sf.fileName.includes(sourceOptions.filePath)) return false;
|
|
561
552
|
return true;
|
|
562
553
|
});
|
package/dist/index.mjs
CHANGED
|
@@ -163,9 +163,6 @@ var SchemaTransformer = class SchemaTransformer {
|
|
|
163
163
|
classCache = /* @__PURE__ */ new WeakMap();
|
|
164
164
|
maxCacheSize;
|
|
165
165
|
autoCleanup;
|
|
166
|
-
loadedFiles = /* @__PURE__ */ new Set();
|
|
167
|
-
processingClasses = /* @__PURE__ */ new Set();
|
|
168
|
-
sourceFiles;
|
|
169
166
|
classFileIndex = /* @__PURE__ */ new Map();
|
|
170
167
|
constructor(tsConfigPath = constants.TS_CONFIG_DEFAULT_PATH, options = {}) {
|
|
171
168
|
this.maxCacheSize = options.maxCacheSize ?? 100;
|
|
@@ -178,13 +175,7 @@ var SchemaTransformer = class SchemaTransformer {
|
|
|
178
175
|
const { options: tsOptions, fileNames } = ts.parseJsonConfigFileContent(config, ts.sys, "./");
|
|
179
176
|
this.program = ts.createProgram(fileNames, tsOptions);
|
|
180
177
|
this.checker = this.program.getTypeChecker();
|
|
181
|
-
this.
|
|
182
|
-
if (sf.isDeclarationFile) return false;
|
|
183
|
-
if (sf.fileName.includes(".d.ts")) return false;
|
|
184
|
-
if (sf.fileName.includes("node_modules")) return false;
|
|
185
|
-
return true;
|
|
186
|
-
});
|
|
187
|
-
this.sourceFiles.forEach((sf) => {
|
|
178
|
+
this.program.getSourceFiles().forEach((sf) => {
|
|
188
179
|
sf.statements.forEach((stmt) => {
|
|
189
180
|
if (ts.isClassDeclaration(stmt) && stmt.name) {
|
|
190
181
|
const name = stmt.name.text;
|
|
@@ -531,7 +522,7 @@ var SchemaTransformer = class SchemaTransformer {
|
|
|
531
522
|
if (sourceOptions === null || sourceOptions === void 0 ? void 0 : sourceOptions.isExternal) return this.program.getSourceFiles().filter((sf) => {
|
|
532
523
|
return sf.fileName.includes(sourceOptions.packageName) && (!sourceOptions.filePath || sf.fileName === sourceOptions.filePath);
|
|
533
524
|
});
|
|
534
|
-
return this.
|
|
525
|
+
return this.program.getSourceFiles().filter((sf) => {
|
|
535
526
|
if ((sourceOptions === null || sourceOptions === void 0 ? void 0 : sourceOptions.filePath) && !sf.fileName.includes(sourceOptions.filePath)) return false;
|
|
536
527
|
return true;
|
|
537
528
|
});
|
package/package.json
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-class-to-openapi",
|
|
3
|
-
"version": "1.3.
|
|
4
|
-
"type": "module",
|
|
3
|
+
"version": "1.3.4",
|
|
5
4
|
"description": "Transform TypeScript classes into OpenAPI 3.1.0 schema objects, which support class-validator decorators",
|
|
5
|
+
"type": "module",
|
|
6
6
|
"main": "./dist/index.cjs",
|
|
7
7
|
"module": "./dist/index.mjs",
|
|
8
8
|
"types": "./dist/index.d.mts",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
},
|
|
68
68
|
"dependencies": {
|
|
69
69
|
"class-validator": "0.15.1",
|
|
70
|
-
"typescript": "
|
|
70
|
+
"typescript": "6.0.2"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@types/node": "24.2.1",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"test": "node --import tsx --test test/testCases/**/*.test.ts",
|
|
82
82
|
"test:watch": "node --import tsx --inspect --test --watch test/testCases/**/*.test.ts",
|
|
83
83
|
"test:coverage": "node --import tsx --test --experimental-test-coverage test/testCases/**/*.test.ts",
|
|
84
|
-
"build": "rm -rf dist && tsdown",
|
|
84
|
+
"build": "tsc --noEmit && rm -rf dist && tsdown",
|
|
85
85
|
"build:watch": "rm -rf dist && tsdown --watch",
|
|
86
86
|
"dev": "node --import tsx --test --inspect --watch ./src/run.ts",
|
|
87
87
|
"format": "prettier --write .",
|