@storm-software/untyped 0.24.261 → 0.24.262

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.
@@ -0,0 +1,89 @@
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
+
3
+ var _chunkX536HIRQcjs = require('./chunk-X536HIRQ.cjs');
4
+
5
+
6
+ var _chunkMB5TG2GOcjs = require('./chunk-MB5TG2GO.cjs');
7
+
8
+
9
+ var _chunk5GIQV6PNcjs = require('./chunk-5GIQV6PN.cjs');
10
+
11
+
12
+
13
+ var _chunkXRKD4GEXcjs = require('./chunk-XRKD4GEX.cjs');
14
+
15
+
16
+ var _chunk4G3IU22Jcjs = require('./chunk-4G3IU22J.cjs');
17
+
18
+ // src/generate.ts
19
+ var _glob = require('glob');
20
+ var _loader = require('untyped/loader');
21
+ var getGenerateAction = (config) => async (options) => {
22
+ _chunkXRKD4GEXcjs.writeTrace.call(void 0,
23
+ `Running Storm Untyped with options: ${JSON.stringify(options)}`,
24
+ config
25
+ );
26
+ const files = await _glob.glob.call(void 0, options.entry || "**/{untyped.ts,*.untyped.ts}", {
27
+ ignore: [
28
+ "**/{*.stories.tsx,*.stories.ts,*.spec.tsx,*.spec.ts}",
29
+ "**/dist/**",
30
+ "**/tmp/**",
31
+ "**/node_modules/**",
32
+ "**/.git/**",
33
+ "**/.cache/**",
34
+ "**/.nx/**"
35
+ ],
36
+ withFileTypes: true,
37
+ cwd: config.workspaceRoot
38
+ });
39
+ await Promise.all(
40
+ files.map(async (file) => {
41
+ _chunkXRKD4GEXcjs.writeTrace.call(void 0,
42
+ `Generating files for schema file: ${_chunk4G3IU22Jcjs.joinPaths.call(void 0, file.parentPath, file.name)}`,
43
+ config
44
+ );
45
+ let schema;
46
+ try {
47
+ schema = await _loader.loadSchema.call(void 0, _chunk4G3IU22Jcjs.joinPaths.call(void 0, file.parentPath, file.name), {
48
+ jiti: {
49
+ fsCache: config.skipCache ? false : _chunk4G3IU22Jcjs.joinPaths.call(void 0,
50
+ config.directories.cache || _chunk4G3IU22Jcjs.joinPaths.call(void 0,
51
+ config.workspaceRoot,
52
+ "node_modules/.cache/storm"
53
+ ),
54
+ "jiti"
55
+ ),
56
+ interopDefault: true
57
+ }
58
+ });
59
+ } catch (error) {
60
+ _chunkXRKD4GEXcjs.writeError.call(void 0,
61
+ `Error while parsing schema file: ${_chunk4G3IU22Jcjs.joinPaths.call(void 0, file.parentPath, file.name)}
62
+
63
+ Error:
64
+ ${_optionalChain([error, 'optionalAccess', _ => _.message]) ? error.message : JSON.stringify(error)}${_optionalChain([error, 'optionalAccess', _2 => _2.stack]) ? `
65
+ Stack Trace: ${error.stack}` : ""}
66
+
67
+ Parsed schema:
68
+ ${JSON.stringify(schema)}
69
+ `,
70
+ config
71
+ );
72
+ throw error;
73
+ }
74
+ const promises = [];
75
+ promises.push(
76
+ _chunkX536HIRQcjs.generateDeclarationFile.call(void 0, schema, file, options.generatedBy, config)
77
+ );
78
+ promises.push(
79
+ _chunk5GIQV6PNcjs.generateMarkdownFile.call(void 0, schema, file, options.generatedBy, config)
80
+ );
81
+ promises.push(_chunkMB5TG2GOcjs.generateJsonSchemaFile.call(void 0, schema, file, config));
82
+ return Promise.all(promises);
83
+ })
84
+ );
85
+ };
86
+
87
+
88
+
89
+ exports.getGenerateAction = getGenerateAction;
@@ -0,0 +1,89 @@
1
+ import {
2
+ generateDeclarationFile
3
+ } from "./chunk-ZQ7SOXEN.js";
4
+ import {
5
+ generateJsonSchemaFile
6
+ } from "./chunk-34SS6W35.js";
7
+ import {
8
+ generateMarkdownFile
9
+ } from "./chunk-5PY7MXWQ.js";
10
+ import {
11
+ writeError,
12
+ writeTrace
13
+ } from "./chunk-RT5SQVG7.js";
14
+ import {
15
+ joinPaths
16
+ } from "./chunk-NTN5YK5X.js";
17
+
18
+ // src/generate.ts
19
+ import { glob } from "glob";
20
+ import { loadSchema } from "untyped/loader";
21
+ var getGenerateAction = (config) => async (options) => {
22
+ writeTrace(
23
+ `Running Storm Untyped with options: ${JSON.stringify(options)}`,
24
+ config
25
+ );
26
+ const files = await glob(options.entry || "**/{untyped.ts,*.untyped.ts}", {
27
+ ignore: [
28
+ "**/{*.stories.tsx,*.stories.ts,*.spec.tsx,*.spec.ts}",
29
+ "**/dist/**",
30
+ "**/tmp/**",
31
+ "**/node_modules/**",
32
+ "**/.git/**",
33
+ "**/.cache/**",
34
+ "**/.nx/**"
35
+ ],
36
+ withFileTypes: true,
37
+ cwd: config.workspaceRoot
38
+ });
39
+ await Promise.all(
40
+ files.map(async (file) => {
41
+ writeTrace(
42
+ `Generating files for schema file: ${joinPaths(file.parentPath, file.name)}`,
43
+ config
44
+ );
45
+ let schema;
46
+ try {
47
+ schema = await loadSchema(joinPaths(file.parentPath, file.name), {
48
+ jiti: {
49
+ fsCache: config.skipCache ? false : joinPaths(
50
+ config.directories.cache || joinPaths(
51
+ config.workspaceRoot,
52
+ "node_modules/.cache/storm"
53
+ ),
54
+ "jiti"
55
+ ),
56
+ interopDefault: true
57
+ }
58
+ });
59
+ } catch (error) {
60
+ writeError(
61
+ `Error while parsing schema file: ${joinPaths(file.parentPath, file.name)}
62
+
63
+ Error:
64
+ ${error?.message ? error.message : JSON.stringify(error)}${error?.stack ? `
65
+ Stack Trace: ${error.stack}` : ""}
66
+
67
+ Parsed schema:
68
+ ${JSON.stringify(schema)}
69
+ `,
70
+ config
71
+ );
72
+ throw error;
73
+ }
74
+ const promises = [];
75
+ promises.push(
76
+ generateDeclarationFile(schema, file, options.generatedBy, config)
77
+ );
78
+ promises.push(
79
+ generateMarkdownFile(schema, file, options.generatedBy, config)
80
+ );
81
+ promises.push(generateJsonSchemaFile(schema, file, config));
82
+ return Promise.all(promises);
83
+ })
84
+ );
85
+ };
86
+
87
+ export {
88
+ getGenerateAction
89
+ };
@@ -0,0 +1,50 @@
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
+
3
+
4
+ var _chunkXRKD4GEXcjs = require('./chunk-XRKD4GEX.cjs');
5
+
6
+
7
+ var _chunk4G3IU22Jcjs = require('./chunk-4G3IU22J.cjs');
8
+
9
+ // src/generators/dts.ts
10
+ var _promises = require('fs/promises');
11
+ var _untyped = require('untyped');
12
+ function generateDeclaration(schema, generatedBy = "@storm-software/untyped") {
13
+ return `
14
+ // Generated by ${generatedBy}
15
+ // Do not edit this file directly
16
+
17
+ ${_untyped.generateTypes.call(void 0, schema, {
18
+ addExport: true,
19
+ partial: true,
20
+ interfaceName: `${_optionalChain([schema, 'access', _ => _.title, 'optionalAccess', _2 => _2.replaceAll, 'call', _3 => _3(" ", "")]) || "Type"}Schema`
21
+ })}
22
+
23
+ `;
24
+ }
25
+ function generateDeclarationFile(schema, file, generatedBy = "@storm-software/untyped", config) {
26
+ try {
27
+ const declarations = _chunk4G3IU22Jcjs.getOutputFile.call(void 0, file, "d.ts");
28
+ _chunkXRKD4GEXcjs.writeTrace.call(void 0, `Writing type declaration file ${declarations}`, config);
29
+ return _promises.writeFile.call(void 0, declarations, generateDeclaration(schema, generatedBy));
30
+ } catch (error) {
31
+ _chunkXRKD4GEXcjs.writeError.call(void 0,
32
+ `Error writing declaration file for ${file.name}
33
+
34
+ Error:
35
+ ${_optionalChain([error, 'optionalAccess', _4 => _4.message]) ? error.message : JSON.stringify(error)}${_optionalChain([error, 'optionalAccess', _5 => _5.stack]) ? `
36
+ Stack Trace: ${error.stack}` : ""}
37
+
38
+ Parsed schema:
39
+ ${JSON.stringify(schema)}
40
+ `,
41
+ config
42
+ );
43
+ throw error;
44
+ }
45
+ }
46
+
47
+
48
+
49
+
50
+ exports.generateDeclaration = generateDeclaration; exports.generateDeclarationFile = generateDeclarationFile;
@@ -0,0 +1,50 @@
1
+ import {
2
+ writeError,
3
+ writeTrace
4
+ } from "./chunk-RT5SQVG7.js";
5
+ import {
6
+ getOutputFile
7
+ } from "./chunk-NTN5YK5X.js";
8
+
9
+ // src/generators/dts.ts
10
+ import { writeFile } from "node:fs/promises";
11
+ import { generateTypes } from "untyped";
12
+ function generateDeclaration(schema, generatedBy = "@storm-software/untyped") {
13
+ return `
14
+ // Generated by ${generatedBy}
15
+ // Do not edit this file directly
16
+
17
+ ${generateTypes(schema, {
18
+ addExport: true,
19
+ partial: true,
20
+ interfaceName: `${schema.title?.replaceAll(" ", "") || "Type"}Schema`
21
+ })}
22
+
23
+ `;
24
+ }
25
+ function generateDeclarationFile(schema, file, generatedBy = "@storm-software/untyped", config) {
26
+ try {
27
+ const declarations = getOutputFile(file, "d.ts");
28
+ writeTrace(`Writing type declaration file ${declarations}`, config);
29
+ return writeFile(declarations, generateDeclaration(schema, generatedBy));
30
+ } catch (error) {
31
+ writeError(
32
+ `Error writing declaration file for ${file.name}
33
+
34
+ Error:
35
+ ${error?.message ? error.message : JSON.stringify(error)}${error?.stack ? `
36
+ Stack Trace: ${error.stack}` : ""}
37
+
38
+ Parsed schema:
39
+ ${JSON.stringify(schema)}
40
+ `,
41
+ config
42
+ );
43
+ throw error;
44
+ }
45
+ }
46
+
47
+ export {
48
+ generateDeclaration,
49
+ generateDeclarationFile
50
+ };
package/dist/generate.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkXREC6U2Wcjs = require('./chunk-XREC6U2W.cjs');
4
- require('./chunk-TSL3OUCZ.cjs');
3
+ var _chunkJRBTWDS4cjs = require('./chunk-JRBTWDS4.cjs');
4
+ require('./chunk-X536HIRQ.cjs');
5
5
  require('./chunk-MB5TG2GO.cjs');
6
6
  require('./chunk-5GIQV6PN.cjs');
7
7
  require('./chunk-XRKD4GEX.cjs');
8
8
  require('./chunk-4G3IU22J.cjs');
9
9
 
10
10
 
11
- exports.getGenerateAction = _chunkXREC6U2Wcjs.getGenerateAction;
11
+ exports.getGenerateAction = _chunkJRBTWDS4cjs.getGenerateAction;
package/dist/generate.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  getGenerateAction
3
- } from "./chunk-TPAE4LOX.js";
4
- import "./chunk-7KF73SSF.js";
3
+ } from "./chunk-SZ7JV7EM.js";
4
+ import "./chunk-ZQ7SOXEN.js";
5
5
  import "./chunk-34SS6W35.js";
6
6
  import "./chunk-5PY7MXWQ.js";
7
7
  import "./chunk-RT5SQVG7.js";
package/dist/index.cjs CHANGED
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkXREC6U2Wcjs = require('./chunk-XREC6U2W.cjs');
3
+ var _chunkJRBTWDS4cjs = require('./chunk-JRBTWDS4.cjs');
4
4
  require('./chunk-TQVHFPJA.cjs');
5
5
 
6
6
 
7
7
 
8
- var _chunkTSL3OUCZcjs = require('./chunk-TSL3OUCZ.cjs');
8
+ var _chunkX536HIRQcjs = require('./chunk-X536HIRQ.cjs');
9
9
 
10
10
 
11
11
  var _chunkMB5TG2GOcjs = require('./chunk-MB5TG2GO.cjs');
@@ -25,4 +25,4 @@ var _chunk4G3IU22Jcjs = require('./chunk-4G3IU22J.cjs');
25
25
 
26
26
 
27
27
 
28
- exports.generateDeclaration = _chunkTSL3OUCZcjs.generateDeclaration; exports.generateDeclarationFile = _chunkTSL3OUCZcjs.generateDeclarationFile; exports.generateJsonSchemaFile = _chunkMB5TG2GOcjs.generateJsonSchemaFile; exports.generateMarkdown = _chunk5GIQV6PNcjs.generateMarkdown; exports.generateMarkdownFile = _chunk5GIQV6PNcjs.generateMarkdownFile; exports.getGenerateAction = _chunkXREC6U2Wcjs.getGenerateAction; exports.getOutputFile = _chunk4G3IU22Jcjs.getOutputFile;
28
+ exports.generateDeclaration = _chunkX536HIRQcjs.generateDeclaration; exports.generateDeclarationFile = _chunkX536HIRQcjs.generateDeclarationFile; exports.generateJsonSchemaFile = _chunkMB5TG2GOcjs.generateJsonSchemaFile; exports.generateMarkdown = _chunk5GIQV6PNcjs.generateMarkdown; exports.generateMarkdownFile = _chunk5GIQV6PNcjs.generateMarkdownFile; exports.getGenerateAction = _chunkJRBTWDS4cjs.getGenerateAction; exports.getOutputFile = _chunk4G3IU22Jcjs.getOutputFile;
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  getGenerateAction
3
- } from "./chunk-TPAE4LOX.js";
3
+ } from "./chunk-SZ7JV7EM.js";
4
4
  import "./chunk-BY5UJMXQ.js";
5
5
  import {
6
6
  generateDeclaration,
7
7
  generateDeclarationFile
8
- } from "./chunk-7KF73SSF.js";
8
+ } from "./chunk-ZQ7SOXEN.js";
9
9
  import {
10
10
  generateJsonSchemaFile
11
11
  } from "./chunk-34SS6W35.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/untyped",
3
- "version": "0.24.261",
3
+ "version": "0.24.262",
4
4
  "private": false,
5
5
  "description": "A package containing `untyped` utilities for building Storm Software libraries and applications",
6
6
  "keywords": [
@@ -176,19 +176,17 @@
176
176
  "storm-untyped-cjs": "./bin/untyped.cjs",
177
177
  "storm-untyped-esm": "./bin/untyped.js"
178
178
  },
179
- "files": ["dist/**/*"],
179
+ "files": ["dist"],
180
180
  "dependencies": {
181
- "@storm-software/config-tools": "1.190.119",
181
+ "@storm-software/config": "1.138.57",
182
+ "@storm-software/config-tools": "1.190.120",
182
183
  "commander": "^12.1.0",
183
184
  "glob": "^11.1.0",
184
185
  "jiti": "^2.7.0",
185
- "knitwork": "^1.3.0"
186
- },
187
- "devDependencies": {
188
- "@types/node": "^25.9.5",
189
- "tsup": "8.4.0",
186
+ "knitwork": "^1.3.0",
190
187
  "untyped": "^2.0.0"
191
188
  },
189
+ "devDependencies": { "@types/node": "^25.9.5", "tsup": "8.4.0" },
192
190
  "publishConfig": { "access": "public" },
193
- "gitHead": "b0295f0d2bd154ea4c2eb15e55e0e6dc62978042"
191
+ "gitHead": "dce519750140dbed032b5cc68e4c35edca8cb846"
194
192
  }