@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.
@@ -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-DH2WY7QT.mjs";
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-DH2WY7QT.mjs";
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 _chunkYMCYTSDOjs = require('./chunk-YMCYTSDO.js');
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
- _chunkZP3OD7IOjs.__name.call(void 0, generateMarkdown, "generateMarkdown");
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
- _chunkZP3OD7IOjs.__name.call(void 0, generateMarkdownLevel, "generateMarkdownLevel");
42
+ _chunkNYKCIVTCjs.__name.call(void 0, generateMarkdownLevel, "generateMarkdownLevel");
46
43
  function generateMarkdownFile(schema, file, config) {
47
44
  try {
48
- const declarations = _chunkZP3OD7IOjs.getOutputFile.call(void 0, file, "md");
49
- _chunkYMCYTSDOjs.writeTrace.call(void 0, `Writing type markdown file ${declarations}`, config);
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
- _chunkYMCYTSDOjs.writeError.call(void 0, `Error writing markdown file for ${file.name}
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
- _chunkZP3OD7IOjs.__name.call(void 0, generateMarkdownFile, "generateMarkdownFile");
61
+ _chunkNYKCIVTCjs.__name.call(void 0, generateMarkdownFile, "generateMarkdownFile");
65
62
 
66
63
 
67
64