@storm-software/untyped 0.2.0 → 0.4.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/README.md +1 -1
- package/bin/untyped.js +6721 -1015
- package/bin/untyped.mjs +6723 -996
- package/dist/{chunk-I5HMFTDJ.js → chunk-6HKRKQSU.js} +7 -10
- package/dist/chunk-6OB6EGVE.js +6853 -0
- package/dist/{chunk-XAGWZ3JW.mjs → chunk-EBIRRCGB.mjs} +2 -5
- package/dist/chunk-GWEQOXW6.mjs +46 -0
- package/dist/{chunk-ZHHYXAVP.mjs → chunk-HSIBHFJE.mjs} +2 -5
- package/dist/{chunk-JRYWLT6J.js → chunk-LWMIR3BQ.js} +8 -11
- package/dist/chunk-MNW76QG7.mjs +6853 -0
- package/dist/chunk-NYKCIVTC.js +46 -0
- package/dist/{chunk-DV7PRVVQ.js → chunk-TJLW3KPU.js} +6 -9
- package/dist/{chunk-OLRKE2WB.mjs → chunk-XSW3ZXMK.mjs} +2 -5
- package/dist/generate.d.mts +2 -3
- package/dist/generate.d.ts +2 -3
- package/dist/generate.js +6 -7
- package/dist/generate.mjs +5 -6
- package/dist/index.js +6 -7
- package/dist/index.mjs +5 -6
- package/dist/utilities.js +2 -2
- package/dist/utilities.mjs +1 -1
- package/package.json +209 -1
- package/dist/chunk-7LOMEJRK.mjs +0 -73
- package/dist/chunk-7OPTVFZK.mjs +0 -388
- package/dist/chunk-DH2WY7QT.mjs +0 -38
- package/dist/chunk-HBHOVTK2.js +0 -73
- package/dist/chunk-YMCYTSDO.js +0 -388
- package/dist/chunk-ZP3OD7IO.js +0 -38
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
writeError,
|
|
3
|
-
writeTrace
|
|
4
|
-
} from "./chunk-7OPTVFZK.mjs";
|
|
5
1
|
import {
|
|
6
2
|
__name,
|
|
7
3
|
getOutputFile
|
|
8
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-GWEQOXW6.mjs";
|
|
9
5
|
|
|
10
6
|
// src/generators/dts.ts
|
|
7
|
+
import { writeError, writeTrace } from "@storm-software/config-tools/logger/console";
|
|
11
8
|
import { writeFile } from "node:fs/promises";
|
|
12
9
|
import { generateTypes } from "untyped";
|
|
13
10
|
function generateDeclaration(schema) {
|
|
@@ -0,0 +1,46 @@
|
|
|
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 __name = (target, value) => __defProp(target, "name", { value, configurable: true });
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
var __copyProps = (to, from, except, desc) => {
|
|
12
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
13
|
+
for (let key of __getOwnPropNames(from))
|
|
14
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
15
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
16
|
+
}
|
|
17
|
+
return to;
|
|
18
|
+
};
|
|
19
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
20
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
21
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
22
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
23
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
24
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
25
|
+
mod
|
|
26
|
+
));
|
|
27
|
+
|
|
28
|
+
// src/utilities.ts
|
|
29
|
+
import { joinPaths } from "@storm-software/config-tools/utilities/correct-paths";
|
|
30
|
+
var getOutputFile = /* @__PURE__ */ __name((file, extension) => {
|
|
31
|
+
let fileName = file.name.slice(0, file.name.lastIndexOf(".")).replace(".untyped", "").replace("untyped", "").replace(".schema", "").replace("schema", "");
|
|
32
|
+
if (!fileName) {
|
|
33
|
+
fileName = "schema";
|
|
34
|
+
}
|
|
35
|
+
if (fileName !== "schema") {
|
|
36
|
+
fileName = `${fileName}.schema`;
|
|
37
|
+
}
|
|
38
|
+
return joinPaths(file.parentPath, `${fileName}.${extension}`);
|
|
39
|
+
}, "getOutputFile");
|
|
40
|
+
|
|
41
|
+
export {
|
|
42
|
+
__name,
|
|
43
|
+
__commonJS,
|
|
44
|
+
__toESM,
|
|
45
|
+
getOutputFile
|
|
46
|
+
};
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import {
|
|
2
|
-
writeError,
|
|
3
|
-
writeTrace
|
|
4
|
-
} from "./chunk-7OPTVFZK.mjs";
|
|
5
1
|
import {
|
|
6
2
|
__name,
|
|
7
3
|
getOutputFile
|
|
8
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-GWEQOXW6.mjs";
|
|
9
5
|
|
|
10
6
|
// src/generators/json-schema.ts
|
|
7
|
+
import { writeError, writeTrace } from "@storm-software/config-tools/logger/console";
|
|
11
8
|
import { writeFile } from "node:fs/promises";
|
|
12
9
|
function generateJsonSchemaFile(schema, file, config) {
|
|
13
10
|
try {
|
|
@@ -1,13 +1,10 @@
|
|
|
1
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
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
var _chunkZP3OD7IOjs = require('./chunk-ZP3OD7IO.js');
|
|
4
|
+
var _chunkNYKCIVTCjs = require('./chunk-NYKCIVTC.js');
|
|
9
5
|
|
|
10
6
|
// src/generators/markdown.ts
|
|
7
|
+
var _console = require('@storm-software/config-tools/logger/console');
|
|
11
8
|
var _promises = require('fs/promises');
|
|
12
9
|
function generateMarkdown(schema) {
|
|
13
10
|
return `
|
|
@@ -18,7 +15,7 @@ ${generateMarkdownLevel(schema, schema.title || "", "#").join("\n")}
|
|
|
18
15
|
|
|
19
16
|
`;
|
|
20
17
|
}
|
|
21
|
-
|
|
18
|
+
_chunkNYKCIVTCjs.__name.call(void 0, generateMarkdown, "generateMarkdown");
|
|
22
19
|
function generateMarkdownLevel(schema, title, level) {
|
|
23
20
|
const lines = [];
|
|
24
21
|
lines.push(`${level} ${title}`);
|
|
@@ -42,14 +39,14 @@ function generateMarkdownLevel(schema, title, level) {
|
|
|
42
39
|
}
|
|
43
40
|
return lines;
|
|
44
41
|
}
|
|
45
|
-
|
|
42
|
+
_chunkNYKCIVTCjs.__name.call(void 0, generateMarkdownLevel, "generateMarkdownLevel");
|
|
46
43
|
function generateMarkdownFile(schema, file, config) {
|
|
47
44
|
try {
|
|
48
|
-
const declarations =
|
|
49
|
-
|
|
45
|
+
const declarations = _chunkNYKCIVTCjs.getOutputFile.call(void 0, file, "md");
|
|
46
|
+
_console.writeTrace.call(void 0, `Writing type markdown file ${declarations}`, config);
|
|
50
47
|
return _promises.writeFile.call(void 0, declarations, generateMarkdown(schema));
|
|
51
48
|
} catch (error) {
|
|
52
|
-
|
|
49
|
+
_console.writeError.call(void 0, `Error writing markdown file for ${file.name}
|
|
53
50
|
|
|
54
51
|
Error:
|
|
55
52
|
${_optionalChain([error, 'optionalAccess', _ => _.message]) ? error.message : JSON.stringify(error)}${_optionalChain([error, 'optionalAccess', _2 => _2.stack]) ? `
|
|
@@ -61,7 +58,7 @@ ${JSON.stringify(schema)}
|
|
|
61
58
|
throw error;
|
|
62
59
|
}
|
|
63
60
|
}
|
|
64
|
-
|
|
61
|
+
_chunkNYKCIVTCjs.__name.call(void 0, generateMarkdownFile, "generateMarkdownFile");
|
|
65
62
|
|
|
66
63
|
|
|
67
64
|
|