@storm-software/untyped 0.24.53 → 0.24.55
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/bin/untyped.cjs +1911 -45201
- package/bin/untyped.js +1912 -45408
- package/dist/{chunk-N77CW7VO.cjs → chunk-4G3IU22J.cjs} +2 -51
- package/dist/chunk-4U6ARZBV.js +259 -0
- package/dist/{chunk-VZDVVM3H.cjs → chunk-AA55W4PI.cjs} +5 -7
- package/dist/{chunk-SEXIX2W6.js → chunk-AXIV4HBX.js} +3 -5
- package/dist/chunk-BY5UJMXQ.js +0 -0
- package/dist/{chunk-EOEWGN5V.cjs → chunk-DNUXDRL4.cjs} +5 -7
- package/dist/chunk-DUNUNFJ4.cjs +259 -0
- package/dist/{chunk-R7JBK4EB.js → chunk-EF33M72U.js} +8 -80
- package/dist/{chunk-2YNZOLYK.cjs → chunk-GXKBPF6R.cjs} +13 -79
- package/dist/{chunk-RRGVVEU6.cjs → chunk-NS7A3OHM.cjs} +33 -105
- package/dist/{chunk-7WW4JGOJ.js → chunk-NTN5YK5X.js} +0 -42
- package/dist/{chunk-H6DCXSE3.js → chunk-OKI3BIEA.js} +3 -5
- package/dist/chunk-TQVHFPJA.cjs +1 -0
- package/dist/{chunk-LWOW6NBO.js → chunk-USMEAXKV.js} +5 -71
- package/dist/generate.cjs +7 -7
- package/dist/generate.js +6 -6
- package/dist/index.cjs +8 -12
- package/dist/index.js +8 -12
- package/dist/utilities.cjs +2 -2
- package/dist/utilities.js +1 -1
- package/package.json +3 -2
- package/dist/chunk-GNDAXJ3C.js +0 -6
- package/dist/chunk-H3BI2RS6.js +0 -1840
- package/dist/chunk-OFYCXEXT.cjs +0 -1832
- package/dist/chunk-X4AHMOF6.cjs +0 -6
|
@@ -5,103 +5,30 @@ import {
|
|
|
5
5
|
mergedTypes,
|
|
6
6
|
normalizeTypes,
|
|
7
7
|
resolveSchema
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-USMEAXKV.js";
|
|
9
9
|
import {
|
|
10
10
|
generateJsonSchemaFile
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-AXIV4HBX.js";
|
|
12
12
|
import {
|
|
13
13
|
generateMarkdownFile
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-OKI3BIEA.js";
|
|
15
15
|
import {
|
|
16
16
|
writeError,
|
|
17
17
|
writeTrace
|
|
18
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-4U6ARZBV.js";
|
|
19
19
|
import {
|
|
20
|
-
init_esm_shims,
|
|
21
20
|
joinPaths
|
|
22
|
-
} from "./chunk-
|
|
21
|
+
} from "./chunk-NTN5YK5X.js";
|
|
23
22
|
|
|
24
23
|
// src/generate.ts
|
|
25
|
-
init_esm_shims();
|
|
26
24
|
import { glob } from "glob";
|
|
27
25
|
|
|
28
26
|
// ../../node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/loader.mjs
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
// ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
|
|
32
|
-
init_esm_shims();
|
|
33
|
-
function isPlainObject(value) {
|
|
34
|
-
if (value === null || typeof value !== "object") {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
const prototype = Object.getPrototypeOf(value);
|
|
38
|
-
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
if (Symbol.iterator in value) {
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
if (Symbol.toStringTag in value) {
|
|
45
|
-
return Object.prototype.toString.call(value) === "[object Module]";
|
|
46
|
-
}
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
50
|
-
if (!isPlainObject(defaults)) {
|
|
51
|
-
return _defu(baseObject, {}, namespace, merger);
|
|
52
|
-
}
|
|
53
|
-
const object = Object.assign({}, defaults);
|
|
54
|
-
for (const key in baseObject) {
|
|
55
|
-
if (key === "__proto__" || key === "constructor") {
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
const value = baseObject[key];
|
|
59
|
-
if (value === null || value === void 0) {
|
|
60
|
-
continue;
|
|
61
|
-
}
|
|
62
|
-
if (merger && merger(object, key, value, namespace)) {
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
66
|
-
object[key] = [...value, ...object[key]];
|
|
67
|
-
} else if (isPlainObject(value) && isPlainObject(object[key])) {
|
|
68
|
-
object[key] = _defu(
|
|
69
|
-
value,
|
|
70
|
-
object[key],
|
|
71
|
-
(namespace ? `${namespace}.` : "") + key.toString(),
|
|
72
|
-
merger
|
|
73
|
-
);
|
|
74
|
-
} else {
|
|
75
|
-
object[key] = value;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return object;
|
|
79
|
-
}
|
|
80
|
-
function createDefu(merger) {
|
|
81
|
-
return (...arguments_) => (
|
|
82
|
-
// eslint-disable-next-line unicorn/no-array-reduce
|
|
83
|
-
arguments_.reduce((p2, c2) => _defu(p2, c2, "", merger), {})
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
var defu = createDefu();
|
|
87
|
-
var defuFn = createDefu((object, key, currentValue) => {
|
|
88
|
-
if (object[key] !== void 0 && typeof currentValue === "function") {
|
|
89
|
-
object[key] = currentValue(object[key]);
|
|
90
|
-
return true;
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
var defuArrayFn = createDefu((object, key, currentValue) => {
|
|
94
|
-
if (Array.isArray(object[key]) && typeof currentValue === "function") {
|
|
95
|
-
object[key] = currentValue(object[key]);
|
|
96
|
-
return true;
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
// ../../node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/loader.mjs
|
|
27
|
+
import { defu } from "defu";
|
|
101
28
|
import { createJiti } from "jiti";
|
|
102
29
|
|
|
103
30
|
// ../../node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/babel.mjs
|
|
104
|
-
|
|
31
|
+
import "scule";
|
|
105
32
|
function getDefaultExportFromCjs(x2) {
|
|
106
33
|
return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
|
|
107
34
|
}
|
|
@@ -6945,6 +6872,7 @@ function inferTSType(tsType, getCode) {
|
|
|
6945
6872
|
}
|
|
6946
6873
|
|
|
6947
6874
|
// ../../node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/loader.mjs
|
|
6875
|
+
import "scule";
|
|
6948
6876
|
async function loadSchema(entryPath, options = {}) {
|
|
6949
6877
|
const jiti = createJiti(
|
|
6950
6878
|
options.cwd || process.cwd(),
|
|
@@ -1,83 +1,16 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkDUNUNFJ4cjs = require('./chunk-DUNUNFJ4.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
var _chunkN77CW7VOcjs = require('./chunk-N77CW7VO.cjs');
|
|
7
|
+
var _chunk4G3IU22Jcjs = require('./chunk-4G3IU22J.cjs');
|
|
9
8
|
|
|
10
9
|
// src/generators/dts.ts
|
|
11
|
-
_chunkN77CW7VOcjs.init_cjs_shims.call(void 0, );
|
|
12
10
|
var _promises = require('fs/promises');
|
|
13
11
|
|
|
14
|
-
// ../../node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/index.mjs
|
|
15
|
-
_chunkN77CW7VOcjs.init_cjs_shims.call(void 0, );
|
|
16
|
-
|
|
17
|
-
// ../../node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.BTwOq8Jl.mjs
|
|
18
|
-
_chunkN77CW7VOcjs.init_cjs_shims.call(void 0, );
|
|
19
|
-
|
|
20
|
-
// ../../node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.Br_uXjZG.mjs
|
|
21
|
-
_chunkN77CW7VOcjs.init_cjs_shims.call(void 0, );
|
|
22
|
-
|
|
23
|
-
// ../../node_modules/.pnpm/scule@1.3.0/node_modules/scule/dist/index.mjs
|
|
24
|
-
_chunkN77CW7VOcjs.init_cjs_shims.call(void 0, );
|
|
25
|
-
var NUMBER_CHAR_RE = /\d/;
|
|
26
|
-
var STR_SPLITTERS = ["-", "_", "/", "."];
|
|
27
|
-
function isUppercase(char = "") {
|
|
28
|
-
if (NUMBER_CHAR_RE.test(char)) {
|
|
29
|
-
return void 0;
|
|
30
|
-
}
|
|
31
|
-
return char !== char.toLowerCase();
|
|
32
|
-
}
|
|
33
|
-
function splitByCase(str, separators) {
|
|
34
|
-
const splitters = _nullishCoalesce(separators, () => ( STR_SPLITTERS));
|
|
35
|
-
const parts = [];
|
|
36
|
-
if (!str || typeof str !== "string") {
|
|
37
|
-
return parts;
|
|
38
|
-
}
|
|
39
|
-
let buff = "";
|
|
40
|
-
let previousUpper;
|
|
41
|
-
let previousSplitter;
|
|
42
|
-
for (const char of str) {
|
|
43
|
-
const isSplitter = splitters.includes(char);
|
|
44
|
-
if (isSplitter === true) {
|
|
45
|
-
parts.push(buff);
|
|
46
|
-
buff = "";
|
|
47
|
-
previousUpper = void 0;
|
|
48
|
-
continue;
|
|
49
|
-
}
|
|
50
|
-
const isUpper = isUppercase(char);
|
|
51
|
-
if (previousSplitter === false) {
|
|
52
|
-
if (previousUpper === false && isUpper === true) {
|
|
53
|
-
parts.push(buff);
|
|
54
|
-
buff = char;
|
|
55
|
-
previousUpper = isUpper;
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
if (previousUpper === true && isUpper === false && buff.length > 1) {
|
|
59
|
-
const lastChar = buff.at(-1);
|
|
60
|
-
parts.push(buff.slice(0, Math.max(0, buff.length - 1)));
|
|
61
|
-
buff = lastChar + char;
|
|
62
|
-
previousUpper = isUpper;
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
buff += char;
|
|
67
|
-
previousUpper = isUpper;
|
|
68
|
-
previousSplitter = isSplitter;
|
|
69
|
-
}
|
|
70
|
-
parts.push(buff);
|
|
71
|
-
return parts;
|
|
72
|
-
}
|
|
73
|
-
function upperFirst(str) {
|
|
74
|
-
return str ? str[0].toUpperCase() + str.slice(1) : "";
|
|
75
|
-
}
|
|
76
|
-
function pascalCase(str, opts) {
|
|
77
|
-
return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => upperFirst(_optionalChain([opts, 'optionalAccess', _ => _.normalize]) ? p.toLowerCase() : p)).join("") : "";
|
|
78
|
-
}
|
|
79
|
-
|
|
80
12
|
// ../../node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/shared/untyped.Br_uXjZG.mjs
|
|
13
|
+
var _scule = require('scule');
|
|
81
14
|
function getType(val) {
|
|
82
15
|
const type = typeof val;
|
|
83
16
|
if (type === "undefined" || val === null) {
|
|
@@ -193,7 +126,7 @@ function getTypeDescriptor(type) {
|
|
|
193
126
|
if (importName && firstType) {
|
|
194
127
|
markdownType = markdownType.replace(
|
|
195
128
|
match[0],
|
|
196
|
-
pascalCase(importName) + pascalCase(firstType)
|
|
129
|
+
_scule.pascalCase.call(void 0, importName) + _scule.pascalCase.call(void 0, firstType)
|
|
197
130
|
);
|
|
198
131
|
}
|
|
199
132
|
}
|
|
@@ -303,6 +236,7 @@ function normalizeSchema(schema, options) {
|
|
|
303
236
|
|
|
304
237
|
// ../../node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/index.mjs
|
|
305
238
|
var _knitwork = require('knitwork');
|
|
239
|
+
|
|
306
240
|
var GenerateTypesDefaults = {
|
|
307
241
|
interfaceName: "Untyped",
|
|
308
242
|
addExport: true,
|
|
@@ -467,7 +401,7 @@ function genFunctionType(schema, opts) {
|
|
|
467
401
|
)}`;
|
|
468
402
|
}
|
|
469
403
|
function genFunctionArgs(args, opts) {
|
|
470
|
-
return _optionalChain([args, 'optionalAccess',
|
|
404
|
+
return _optionalChain([args, 'optionalAccess', _ => _.map, 'call', _2 => _2((arg) => {
|
|
471
405
|
let argStr = arg.name;
|
|
472
406
|
if (arg.optional || arg.default) {
|
|
473
407
|
argStr += "?";
|
|
@@ -476,7 +410,7 @@ function genFunctionArgs(args, opts) {
|
|
|
476
410
|
argStr += `: ${getTsType(arg, opts)}`;
|
|
477
411
|
}
|
|
478
412
|
return argStr;
|
|
479
|
-
}), 'access',
|
|
413
|
+
}), 'access', _3 => _3.join, 'call', _4 => _4(", ")]) || "";
|
|
480
414
|
}
|
|
481
415
|
function generateJSDoc(schema, opts) {
|
|
482
416
|
opts.defaultDescription = opts.defaultDescription || opts.defaultDescrption;
|
|
@@ -529,22 +463,22 @@ function generateDeclaration(schema, generatedBy = "@storm-software/untyped") {
|
|
|
529
463
|
${generateTypes(schema, {
|
|
530
464
|
addExport: true,
|
|
531
465
|
partial: true,
|
|
532
|
-
interfaceName: `${_optionalChain([schema, 'access',
|
|
466
|
+
interfaceName: `${_optionalChain([schema, 'access', _5 => _5.title, 'optionalAccess', _6 => _6.replaceAll, 'call', _7 => _7(" ", "")]) || "Type"}Schema`
|
|
533
467
|
})}
|
|
534
468
|
|
|
535
469
|
`;
|
|
536
470
|
}
|
|
537
471
|
function generateDeclarationFile(schema, file, generatedBy = "@storm-software/untyped", config) {
|
|
538
472
|
try {
|
|
539
|
-
const declarations =
|
|
540
|
-
|
|
473
|
+
const declarations = _chunk4G3IU22Jcjs.getOutputFile.call(void 0, file, "d.ts");
|
|
474
|
+
_chunkDUNUNFJ4cjs.writeTrace.call(void 0, `Writing type declaration file ${declarations}`, config);
|
|
541
475
|
return _promises.writeFile.call(void 0, declarations, generateDeclaration(schema, generatedBy));
|
|
542
476
|
} catch (error) {
|
|
543
|
-
|
|
477
|
+
_chunkDUNUNFJ4cjs.writeError.call(void 0,
|
|
544
478
|
`Error writing declaration file for ${file.name}
|
|
545
479
|
|
|
546
480
|
Error:
|
|
547
|
-
${_optionalChain([error, 'optionalAccess',
|
|
481
|
+
${_optionalChain([error, 'optionalAccess', _8 => _8.message]) ? error.message : JSON.stringify(error)}${_optionalChain([error, 'optionalAccess', _9 => _9.stack]) ? `
|
|
548
482
|
Stack Trace: ${error.stack}` : ""}
|
|
549
483
|
|
|
550
484
|
Parsed schema:
|
|
@@ -5,103 +5,30 @@
|
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkGXKBPF6Rcjs = require('./chunk-GXKBPF6R.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
|
-
var
|
|
11
|
+
var _chunkDNUXDRL4cjs = require('./chunk-DNUXDRL4.cjs');
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
var
|
|
14
|
+
var _chunkAA55W4PIcjs = require('./chunk-AA55W4PI.cjs');
|
|
15
15
|
|
|
16
16
|
|
|
17
17
|
|
|
18
|
-
var
|
|
18
|
+
var _chunkDUNUNFJ4cjs = require('./chunk-DUNUNFJ4.cjs');
|
|
19
19
|
|
|
20
20
|
|
|
21
|
-
|
|
22
|
-
var _chunkN77CW7VOcjs = require('./chunk-N77CW7VO.cjs');
|
|
21
|
+
var _chunk4G3IU22Jcjs = require('./chunk-4G3IU22J.cjs');
|
|
23
22
|
|
|
24
23
|
// src/generate.ts
|
|
25
|
-
_chunkN77CW7VOcjs.init_cjs_shims.call(void 0, );
|
|
26
24
|
var _glob = require('glob');
|
|
27
25
|
|
|
28
26
|
// ../../node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/loader.mjs
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
// ../../node_modules/.pnpm/defu@6.1.4/node_modules/defu/dist/defu.mjs
|
|
32
|
-
_chunkN77CW7VOcjs.init_cjs_shims.call(void 0, );
|
|
33
|
-
function isPlainObject(value) {
|
|
34
|
-
if (value === null || typeof value !== "object") {
|
|
35
|
-
return false;
|
|
36
|
-
}
|
|
37
|
-
const prototype = Object.getPrototypeOf(value);
|
|
38
|
-
if (prototype !== null && prototype !== Object.prototype && Object.getPrototypeOf(prototype) !== null) {
|
|
39
|
-
return false;
|
|
40
|
-
}
|
|
41
|
-
if (Symbol.iterator in value) {
|
|
42
|
-
return false;
|
|
43
|
-
}
|
|
44
|
-
if (Symbol.toStringTag in value) {
|
|
45
|
-
return Object.prototype.toString.call(value) === "[object Module]";
|
|
46
|
-
}
|
|
47
|
-
return true;
|
|
48
|
-
}
|
|
49
|
-
function _defu(baseObject, defaults, namespace = ".", merger) {
|
|
50
|
-
if (!isPlainObject(defaults)) {
|
|
51
|
-
return _defu(baseObject, {}, namespace, merger);
|
|
52
|
-
}
|
|
53
|
-
const object = Object.assign({}, defaults);
|
|
54
|
-
for (const key in baseObject) {
|
|
55
|
-
if (key === "__proto__" || key === "constructor") {
|
|
56
|
-
continue;
|
|
57
|
-
}
|
|
58
|
-
const value = baseObject[key];
|
|
59
|
-
if (value === null || value === void 0) {
|
|
60
|
-
continue;
|
|
61
|
-
}
|
|
62
|
-
if (merger && merger(object, key, value, namespace)) {
|
|
63
|
-
continue;
|
|
64
|
-
}
|
|
65
|
-
if (Array.isArray(value) && Array.isArray(object[key])) {
|
|
66
|
-
object[key] = [...value, ...object[key]];
|
|
67
|
-
} else if (isPlainObject(value) && isPlainObject(object[key])) {
|
|
68
|
-
object[key] = _defu(
|
|
69
|
-
value,
|
|
70
|
-
object[key],
|
|
71
|
-
(namespace ? `${namespace}.` : "") + key.toString(),
|
|
72
|
-
merger
|
|
73
|
-
);
|
|
74
|
-
} else {
|
|
75
|
-
object[key] = value;
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
return object;
|
|
79
|
-
}
|
|
80
|
-
function createDefu(merger) {
|
|
81
|
-
return (...arguments_) => (
|
|
82
|
-
// eslint-disable-next-line unicorn/no-array-reduce
|
|
83
|
-
arguments_.reduce((p2, c2) => _defu(p2, c2, "", merger), {})
|
|
84
|
-
);
|
|
85
|
-
}
|
|
86
|
-
var defu = createDefu();
|
|
87
|
-
var defuFn = createDefu((object, key, currentValue) => {
|
|
88
|
-
if (object[key] !== void 0 && typeof currentValue === "function") {
|
|
89
|
-
object[key] = currentValue(object[key]);
|
|
90
|
-
return true;
|
|
91
|
-
}
|
|
92
|
-
});
|
|
93
|
-
var defuArrayFn = createDefu((object, key, currentValue) => {
|
|
94
|
-
if (Array.isArray(object[key]) && typeof currentValue === "function") {
|
|
95
|
-
object[key] = currentValue(object[key]);
|
|
96
|
-
return true;
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
// ../../node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/loader.mjs
|
|
27
|
+
var _defu = require('defu');
|
|
101
28
|
var _jiti = require('jiti');
|
|
102
29
|
|
|
103
30
|
// ../../node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/babel.mjs
|
|
104
|
-
|
|
31
|
+
require('scule');
|
|
105
32
|
function getDefaultExportFromCjs(x2) {
|
|
106
33
|
return x2 && x2.__esModule && Object.prototype.hasOwnProperty.call(x2, "default") ? x2["default"] : x2;
|
|
107
34
|
}
|
|
@@ -6700,7 +6627,7 @@ var babelPluginUntyped = function(api, options) {
|
|
|
6700
6627
|
if (p2.parent.type !== "ExportNamedDeclaration" && p2.parent.type !== "ExportDefaultDeclaration") {
|
|
6701
6628
|
return;
|
|
6702
6629
|
}
|
|
6703
|
-
const _getLines =
|
|
6630
|
+
const _getLines = _chunkGXKBPF6Rcjs.cachedFn.call(void 0, () => this.file.code.split("\n"));
|
|
6704
6631
|
const getCode = (loc) => {
|
|
6705
6632
|
if (!loc) {
|
|
6706
6633
|
return "";
|
|
@@ -6726,7 +6653,7 @@ var babelPluginUntyped = function(api, options) {
|
|
|
6726
6653
|
if (lparam.typeAnnotation) {
|
|
6727
6654
|
Object.assign(
|
|
6728
6655
|
arg,
|
|
6729
|
-
|
|
6656
|
+
_chunkGXKBPF6Rcjs.mergedTypes.call(void 0,
|
|
6730
6657
|
arg,
|
|
6731
6658
|
inferAnnotationType(lparam.typeAnnotation, getCode)
|
|
6732
6659
|
)
|
|
@@ -6735,7 +6662,7 @@ var babelPluginUntyped = function(api, options) {
|
|
|
6735
6662
|
if (param.type === "AssignmentPattern") {
|
|
6736
6663
|
Object.assign(
|
|
6737
6664
|
arg,
|
|
6738
|
-
|
|
6665
|
+
_chunkGXKBPF6Rcjs.mergedTypes.call(void 0, arg, inferArgType(param.right))
|
|
6739
6666
|
);
|
|
6740
6667
|
}
|
|
6741
6668
|
schema.args = schema.args || [];
|
|
@@ -6749,7 +6676,7 @@ var babelPluginUntyped = function(api, options) {
|
|
|
6749
6676
|
const { type } = _optionalChain([tag, 'access', _27 => _27.match, 'call', _28 => _28(/^@returns\s+{(?<type>[\S\s]+)}/), 'optionalAccess', _29 => _29.groups]) || {};
|
|
6750
6677
|
if (type) {
|
|
6751
6678
|
schema.returns = schema.returns || {};
|
|
6752
|
-
Object.assign(schema.returns,
|
|
6679
|
+
Object.assign(schema.returns, _chunkGXKBPF6Rcjs.getTypeDescriptor.call(void 0, type));
|
|
6753
6680
|
return false;
|
|
6754
6681
|
}
|
|
6755
6682
|
}
|
|
@@ -6758,7 +6685,7 @@ var babelPluginUntyped = function(api, options) {
|
|
|
6758
6685
|
if (type && param) {
|
|
6759
6686
|
const arg = _optionalChain([schema, 'access', _33 => _33.args, 'optionalAccess', _34 => _34.find, 'call', _35 => _35((arg2) => arg2.name === param)]);
|
|
6760
6687
|
if (arg) {
|
|
6761
|
-
Object.assign(arg,
|
|
6688
|
+
Object.assign(arg, _chunkGXKBPF6Rcjs.getTypeDescriptor.call(void 0, type));
|
|
6762
6689
|
return false;
|
|
6763
6690
|
}
|
|
6764
6691
|
}
|
|
@@ -6834,7 +6761,7 @@ function parseJSDocs(input) {
|
|
|
6834
6761
|
if (!type) {
|
|
6835
6762
|
continue;
|
|
6836
6763
|
}
|
|
6837
|
-
Object.assign(schema,
|
|
6764
|
+
Object.assign(schema, _chunkGXKBPF6Rcjs.getTypeDescriptor.call(void 0, type));
|
|
6838
6765
|
for (const typedef in typedefs) {
|
|
6839
6766
|
schema.markdownType = type;
|
|
6840
6767
|
if (schema.tsType) {
|
|
@@ -6894,20 +6821,20 @@ var AST_JSTYPE_MAP = {
|
|
|
6894
6821
|
};
|
|
6895
6822
|
function inferArgType(e2, getCode) {
|
|
6896
6823
|
if (AST_JSTYPE_MAP[e2.type]) {
|
|
6897
|
-
return
|
|
6824
|
+
return _chunkGXKBPF6Rcjs.getTypeDescriptor.call(void 0, AST_JSTYPE_MAP[e2.type]);
|
|
6898
6825
|
}
|
|
6899
6826
|
if (e2.type === "AssignmentExpression") {
|
|
6900
6827
|
return inferArgType(e2.right);
|
|
6901
6828
|
}
|
|
6902
6829
|
if (e2.type === "NewExpression" && e2.callee.type === "Identifier") {
|
|
6903
|
-
return
|
|
6830
|
+
return _chunkGXKBPF6Rcjs.getTypeDescriptor.call(void 0, e2.callee.name);
|
|
6904
6831
|
}
|
|
6905
6832
|
if (e2.type === "ArrayExpression" || e2.type === "TupleExpression") {
|
|
6906
6833
|
const itemTypes = e2.elements.filter((el) => r.isExpression(el)).flatMap((el) => inferArgType(el).type);
|
|
6907
6834
|
return {
|
|
6908
6835
|
type: "array",
|
|
6909
6836
|
items: {
|
|
6910
|
-
type:
|
|
6837
|
+
type: _chunkGXKBPF6Rcjs.normalizeTypes.call(void 0, itemTypes)
|
|
6911
6838
|
}
|
|
6912
6839
|
};
|
|
6913
6840
|
}
|
|
@@ -6930,10 +6857,10 @@ function inferTSType(tsType, getCode) {
|
|
|
6930
6857
|
items: inferTSType(tsType.typeParameters.params[0], getCode)
|
|
6931
6858
|
};
|
|
6932
6859
|
}
|
|
6933
|
-
return
|
|
6860
|
+
return _chunkGXKBPF6Rcjs.getTypeDescriptor.call(void 0, getCode(tsType.loc));
|
|
6934
6861
|
}
|
|
6935
6862
|
if (tsType.type === "TSUnionType") {
|
|
6936
|
-
return
|
|
6863
|
+
return _chunkGXKBPF6Rcjs.mergedTypes.call(void 0, ...tsType.types.map((t2) => inferTSType(t2, getCode)));
|
|
6937
6864
|
}
|
|
6938
6865
|
if (tsType.type === "TSArrayType") {
|
|
6939
6866
|
return {
|
|
@@ -6941,14 +6868,15 @@ function inferTSType(tsType, getCode) {
|
|
|
6941
6868
|
items: inferTSType(tsType.elementType, getCode)
|
|
6942
6869
|
};
|
|
6943
6870
|
}
|
|
6944
|
-
return
|
|
6871
|
+
return _chunkGXKBPF6Rcjs.getTypeDescriptor.call(void 0, getCode(tsType.loc));
|
|
6945
6872
|
}
|
|
6946
6873
|
|
|
6947
6874
|
// ../../node_modules/.pnpm/untyped@2.0.0/node_modules/untyped/dist/loader/loader.mjs
|
|
6875
|
+
|
|
6948
6876
|
async function loadSchema(entryPath, options = {}) {
|
|
6949
6877
|
const jiti = _jiti.createJiti.call(void 0,
|
|
6950
6878
|
options.cwd || process.cwd(),
|
|
6951
|
-
defu(options.jiti, {
|
|
6879
|
+
_defu.defu.call(void 0, options.jiti, {
|
|
6952
6880
|
interopDefault: true,
|
|
6953
6881
|
transformOptions: {
|
|
6954
6882
|
babel: {
|
|
@@ -6962,7 +6890,7 @@ async function loadSchema(entryPath, options = {}) {
|
|
|
6962
6890
|
if (rawSchemaKeys.length === 1 && rawSchemaKeys[0] === "default") {
|
|
6963
6891
|
rawSchema = rawSchema.default;
|
|
6964
6892
|
}
|
|
6965
|
-
const schema = await
|
|
6893
|
+
const schema = await _chunkGXKBPF6Rcjs.resolveSchema.call(void 0, rawSchema, options.defaults, {
|
|
6966
6894
|
ignoreDefaults: options.ignoreDefaults
|
|
6967
6895
|
});
|
|
6968
6896
|
return schema;
|
|
@@ -6970,7 +6898,7 @@ async function loadSchema(entryPath, options = {}) {
|
|
|
6970
6898
|
|
|
6971
6899
|
// src/generate.ts
|
|
6972
6900
|
var getGenerateAction = (config) => async (options) => {
|
|
6973
|
-
|
|
6901
|
+
_chunkDUNUNFJ4cjs.writeTrace.call(void 0,
|
|
6974
6902
|
`Running Storm Untyped with options: ${JSON.stringify(options)}`,
|
|
6975
6903
|
config
|
|
6976
6904
|
);
|
|
@@ -6989,16 +6917,16 @@ var getGenerateAction = (config) => async (options) => {
|
|
|
6989
6917
|
});
|
|
6990
6918
|
await Promise.all(
|
|
6991
6919
|
files.map(async (file) => {
|
|
6992
|
-
|
|
6993
|
-
`Generating files for schema file: ${
|
|
6920
|
+
_chunkDUNUNFJ4cjs.writeTrace.call(void 0,
|
|
6921
|
+
`Generating files for schema file: ${_chunk4G3IU22Jcjs.joinPaths.call(void 0, file.parentPath, file.name)}`,
|
|
6994
6922
|
config
|
|
6995
6923
|
);
|
|
6996
6924
|
let schema;
|
|
6997
6925
|
try {
|
|
6998
|
-
schema = await loadSchema(
|
|
6926
|
+
schema = await loadSchema(_chunk4G3IU22Jcjs.joinPaths.call(void 0, file.parentPath, file.name), {
|
|
6999
6927
|
jiti: {
|
|
7000
|
-
fsCache: config.skipCache ? false :
|
|
7001
|
-
config.directories.cache ||
|
|
6928
|
+
fsCache: config.skipCache ? false : _chunk4G3IU22Jcjs.joinPaths.call(void 0,
|
|
6929
|
+
config.directories.cache || _chunk4G3IU22Jcjs.joinPaths.call(void 0,
|
|
7002
6930
|
config.workspaceRoot,
|
|
7003
6931
|
"node_modules/.cache/storm"
|
|
7004
6932
|
),
|
|
@@ -7008,8 +6936,8 @@ var getGenerateAction = (config) => async (options) => {
|
|
|
7008
6936
|
}
|
|
7009
6937
|
});
|
|
7010
6938
|
} catch (error) {
|
|
7011
|
-
|
|
7012
|
-
`Error while parsing schema file: ${
|
|
6939
|
+
_chunkDUNUNFJ4cjs.writeError.call(void 0,
|
|
6940
|
+
`Error while parsing schema file: ${_chunk4G3IU22Jcjs.joinPaths.call(void 0, file.parentPath, file.name)}
|
|
7013
6941
|
|
|
7014
6942
|
Error:
|
|
7015
6943
|
${_optionalChain([error, 'optionalAccess', _43 => _43.message]) ? error.message : JSON.stringify(error)}${_optionalChain([error, 'optionalAccess', _44 => _44.stack]) ? `
|
|
@@ -7024,12 +6952,12 @@ ${JSON.stringify(schema)}
|
|
|
7024
6952
|
}
|
|
7025
6953
|
const promises = [];
|
|
7026
6954
|
promises.push(
|
|
7027
|
-
|
|
6955
|
+
_chunkGXKBPF6Rcjs.generateDeclarationFile.call(void 0, schema, file, options.generatedBy, config)
|
|
7028
6956
|
);
|
|
7029
6957
|
promises.push(
|
|
7030
|
-
|
|
6958
|
+
_chunkAA55W4PIcjs.generateMarkdownFile.call(void 0, schema, file, options.generatedBy, config)
|
|
7031
6959
|
);
|
|
7032
|
-
promises.push(
|
|
6960
|
+
promises.push(_chunkDNUXDRL4cjs.generateJsonSchemaFile.call(void 0, schema, file, config));
|
|
7033
6961
|
return Promise.all(promises);
|
|
7034
6962
|
})
|
|
7035
6963
|
);
|
|
@@ -1,43 +1,4 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
|
-
var __defProp = Object.defineProperty;
|
|
3
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
6
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
7
|
-
var __esm = (fn, res) => function __init() {
|
|
8
|
-
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
9
|
-
};
|
|
10
|
-
var __commonJS = (cb, mod) => function __require() {
|
|
11
|
-
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
12
|
-
};
|
|
13
|
-
var __copyProps = (to, from, except, desc) => {
|
|
14
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
15
|
-
for (let key of __getOwnPropNames(from))
|
|
16
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
17
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
18
|
-
}
|
|
19
|
-
return to;
|
|
20
|
-
};
|
|
21
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
22
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
23
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
24
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
25
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
26
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
27
|
-
mod
|
|
28
|
-
));
|
|
29
|
-
|
|
30
|
-
// ../../node_modules/.pnpm/tsup@8.4.0_patch_hash=751a554d775c3572381af4e7e5fa22eeda6dd6856012fb1cf521d6806eb2dc74__49fd9f9c3810cfbcde6f76ae97a1dcf0/node_modules/tsup/assets/esm_shims.js
|
|
31
|
-
var init_esm_shims = __esm({
|
|
32
|
-
"../../node_modules/.pnpm/tsup@8.4.0_patch_hash=751a554d775c3572381af4e7e5fa22eeda6dd6856012fb1cf521d6806eb2dc74__49fd9f9c3810cfbcde6f76ae97a1dcf0/node_modules/tsup/assets/esm_shims.js"() {
|
|
33
|
-
}
|
|
34
|
-
});
|
|
35
|
-
|
|
36
|
-
// src/utilities.ts
|
|
37
|
-
init_esm_shims();
|
|
38
|
-
|
|
39
1
|
// ../config-tools/src/utilities/correct-paths.ts
|
|
40
|
-
init_esm_shims();
|
|
41
2
|
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
42
3
|
function normalizeWindowsPath(input = "") {
|
|
43
4
|
if (!input) {
|
|
@@ -175,9 +136,6 @@ var getOutputFile = (file, extension) => {
|
|
|
175
136
|
};
|
|
176
137
|
|
|
177
138
|
export {
|
|
178
|
-
__commonJS,
|
|
179
|
-
__toESM,
|
|
180
|
-
init_esm_shims,
|
|
181
139
|
joinPaths,
|
|
182
140
|
getOutputFile
|
|
183
141
|
};
|
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
writeError,
|
|
3
3
|
writeTrace
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-4U6ARZBV.js";
|
|
5
5
|
import {
|
|
6
|
-
getOutputFile
|
|
7
|
-
|
|
8
|
-
} from "./chunk-7WW4JGOJ.js";
|
|
6
|
+
getOutputFile
|
|
7
|
+
} from "./chunk-NTN5YK5X.js";
|
|
9
8
|
|
|
10
9
|
// src/generators/markdown.ts
|
|
11
|
-
init_esm_shims();
|
|
12
10
|
import { writeFile } from "node:fs/promises";
|
|
13
11
|
function generateMarkdown(schema, generatedBy = "@storm-software/untyped") {
|
|
14
12
|
return `
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";
|