quicktype-typescript-input 23.3.25 → 24.0.1
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 +8 -34
- package/package.json +24 -22
package/dist/index.js
CHANGED
|
@@ -1,32 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.schemaForTypeScriptSources =
|
|
27
|
-
const typescript_json_schema_1 = require("@mark.probst/typescript-json-schema");
|
|
3
|
+
exports.schemaForTypeScriptSources = schemaForTypeScriptSources;
|
|
28
4
|
const quicktype_core_1 = require("quicktype-core");
|
|
29
|
-
const
|
|
5
|
+
const typescript_json_schema_1 = require("typescript-json-schema");
|
|
30
6
|
const settings = {
|
|
31
7
|
required: true,
|
|
32
8
|
titles: true,
|
|
@@ -37,8 +13,8 @@ const compilerOptions = {
|
|
|
37
13
|
noEmit: true,
|
|
38
14
|
emitDecoratorMetadata: true,
|
|
39
15
|
experimentalDecorators: true,
|
|
40
|
-
target: ts.ScriptTarget.ES5,
|
|
41
|
-
module: ts.ModuleKind.CommonJS,
|
|
16
|
+
target: typescript_json_schema_1.ts.ScriptTarget.ES5,
|
|
17
|
+
module: typescript_json_schema_1.ts.ModuleKind.CommonJS,
|
|
42
18
|
strictNullChecks: true,
|
|
43
19
|
typeRoots: [],
|
|
44
20
|
rootDir: ".",
|
|
@@ -47,15 +23,14 @@ const compilerOptions = {
|
|
|
47
23
|
// the schema directly.
|
|
48
24
|
function schemaForTypeScriptSources(sourceFileNames) {
|
|
49
25
|
var _a, _b, _c, _d;
|
|
50
|
-
const program = ts.createProgram(sourceFileNames, compilerOptions);
|
|
51
|
-
const diagnostics = ts.getPreEmitDiagnostics(program);
|
|
52
|
-
const error = diagnostics.find((d) => d.category === ts.DiagnosticCategory.Error);
|
|
26
|
+
const program = typescript_json_schema_1.ts.createProgram(sourceFileNames, compilerOptions);
|
|
27
|
+
const diagnostics = typescript_json_schema_1.ts.getPreEmitDiagnostics(program);
|
|
28
|
+
const error = diagnostics.find((d) => d.category === typescript_json_schema_1.ts.DiagnosticCategory.Error);
|
|
53
29
|
if (error !== undefined) {
|
|
54
30
|
return (0, quicktype_core_1.messageError)("TypeScriptCompilerError", {
|
|
55
|
-
message: ts.flattenDiagnosticMessageText(error.messageText, "\n"),
|
|
31
|
+
message: typescript_json_schema_1.ts.flattenDiagnosticMessageText(error.messageText, "\n"),
|
|
56
32
|
});
|
|
57
33
|
}
|
|
58
|
-
// this breaks after upgrading to TS 5+
|
|
59
34
|
const schema = (0, typescript_json_schema_1.generateSchema)(program, "*", settings);
|
|
60
35
|
const uris = [];
|
|
61
36
|
let topLevelName = "";
|
|
@@ -114,4 +89,3 @@ function schemaForTypeScriptSources(sourceFileNames) {
|
|
|
114
89
|
isConverted: true,
|
|
115
90
|
};
|
|
116
91
|
}
|
|
117
|
-
exports.schemaForTypeScriptSources = schemaForTypeScriptSources;
|
package/package.json
CHANGED
|
@@ -1,24 +1,26 @@
|
|
|
1
1
|
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
"
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
2
|
+
"name": "quicktype-typescript-input",
|
|
3
|
+
"version": "24.0.1",
|
|
4
|
+
"description": "Package for using TypeScript as an input language to quicktype",
|
|
5
|
+
"license": "Apache-2.0",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"repository": "https://github.com/glideapps/quicktype",
|
|
9
|
+
"engines": {
|
|
10
|
+
"node": ">=20.0.0"
|
|
11
|
+
},
|
|
12
|
+
"scripts": {
|
|
13
|
+
"clean": "rm -rf dist node_modules *~",
|
|
14
|
+
"build": "node ../../node_modules/typescript/bin/tsc"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"quicktype-core": "24.0.1",
|
|
18
|
+
"typescript-json-schema": "0.67.4"
|
|
19
|
+
},
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@types/node": "~20.19.0"
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
]
|
|
24
26
|
}
|