@storm-software/untyped 0.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.
@@ -0,0 +1,73 @@
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 _chunk4E62JEHLjs = require('./chunk-4E62JEHL.js');
4
+
5
+
6
+ var _chunkBBZKEOA5js = require('./chunk-BBZKEOA5.js');
7
+
8
+
9
+ var _chunkRXZL622Njs = require('./chunk-RXZL622N.js');
10
+
11
+
12
+
13
+
14
+ var _chunkPSNCUPEFjs = require('./chunk-PSNCUPEF.js');
15
+
16
+
17
+
18
+ var _chunk64SOMW7Ajs = require('./chunk-64SOMW7A.js');
19
+
20
+ // src/generate.ts
21
+ var _glob = require('glob');
22
+ var _loader = require('untyped/loader');
23
+ var getGenerateAction = /* @__PURE__ */ _chunk64SOMW7Ajs.__name.call(void 0, (config) => async (options) => {
24
+ const files = await _glob.glob.call(void 0, options.entry, {
25
+ ignore: [
26
+ "**/{*.stories.tsx,*.stories.ts,*.spec.tsx,*.spec.ts}",
27
+ "**/dist/**",
28
+ "**/tmp/**",
29
+ "**/node_modules/**",
30
+ "**/.git/**",
31
+ "**/.cache/**",
32
+ "**/.nx/**"
33
+ ],
34
+ withFileTypes: true,
35
+ cwd: config.workspaceRoot
36
+ });
37
+ const cache = !Boolean(process.env.CI) && !Boolean(process.env.STORM_CI) && !config.skipCache;
38
+ _chunkPSNCUPEFjs.writeTrace.call(void 0, cache ? `Skipping jiti cache because ${Boolean(process.env.CI) ? '`process.env.CI` is set to "true"' : Boolean(process.env.STORM_CI) ? '`process.env.STORM_CI` is set to "true"' : config.skipCache ? "`skipCache` in the Storm configuration file is set to `true`" : "<INVALID REASON>"}` : "Will use jiti cache while parsing schema files", config);
39
+ await Promise.all(files.map(async (file) => {
40
+ _chunkPSNCUPEFjs.writeTrace.call(void 0, `Generating files for schema file: ${_chunk64SOMW7Ajs.joinPaths.call(void 0, file.parentPath, file.name)}`, config);
41
+ let schema;
42
+ try {
43
+ schema = await _loader.loadSchema.call(void 0, _chunk64SOMW7Ajs.joinPaths.call(void 0, file.parentPath, file.name), {
44
+ jiti: {
45
+ debug: _chunkPSNCUPEFjs.isVerbose.call(void 0, config.logLevel),
46
+ fsCache: cache && _chunk64SOMW7Ajs.joinPaths.call(void 0, config.directories.cache || "node_modules/.cache", "storm", "untyped"),
47
+ moduleCache: cache,
48
+ interopDefault: true
49
+ }
50
+ });
51
+ } catch (error) {
52
+ _chunkPSNCUPEFjs.writeError.call(void 0, `Error while parsing schema file: ${_chunk64SOMW7Ajs.joinPaths.call(void 0, file.parentPath, file.name)}
53
+
54
+ Error:
55
+ ${_optionalChain([error, 'optionalAccess', _ => _.message]) ? error.message : JSON.stringify(error)}${_optionalChain([error, 'optionalAccess', _2 => _2.stack]) ? `
56
+ Stack Trace: ${error.stack}` : ""}
57
+
58
+ Parsed schema:
59
+ ${JSON.stringify(schema)}
60
+ `, config);
61
+ throw error;
62
+ }
63
+ const promises = [];
64
+ promises.push(_chunk4E62JEHLjs.generateDeclarationFile.call(void 0, schema, file, config));
65
+ promises.push(_chunkRXZL622Njs.generateMarkdownFile.call(void 0, schema, file, config));
66
+ promises.push(_chunkBBZKEOA5js.generateJsonSchemaFile.call(void 0, schema, file, config));
67
+ return Promise.all(promises);
68
+ }));
69
+ }, "getGenerateAction");
70
+
71
+
72
+
73
+ exports.getGenerateAction = getGenerateAction;
@@ -0,0 +1,387 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } 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 _chunk64SOMW7Ajs = require('./chunk-64SOMW7A.js');
4
+
5
+ // ../config-tools/src/types.ts
6
+ var LogLevel = {
7
+ SILENT: 0,
8
+ FATAL: 10,
9
+ ERROR: 20,
10
+ WARN: 30,
11
+ SUCCESS: 35,
12
+ INFO: 40,
13
+ DEBUG: 60,
14
+ TRACE: 70,
15
+ ALL: 100
16
+ };
17
+ var LogLevelLabel = {
18
+ SILENT: "silent",
19
+ FATAL: "fatal",
20
+ ERROR: "error",
21
+ WARN: "warn",
22
+ SUCCESS: "success",
23
+ INFO: "info",
24
+ DEBUG: "debug",
25
+ TRACE: "trace",
26
+ ALL: "all"
27
+ };
28
+
29
+ // ../config-tools/src/logger/get-log-level.ts
30
+ var getLogLevel = /* @__PURE__ */ _chunk64SOMW7Ajs.__name.call(void 0, (label) => {
31
+ switch (label) {
32
+ case "all":
33
+ return LogLevel.ALL;
34
+ case "trace":
35
+ return LogLevel.TRACE;
36
+ case "debug":
37
+ return LogLevel.DEBUG;
38
+ case "info":
39
+ return LogLevel.INFO;
40
+ case "warn":
41
+ return LogLevel.WARN;
42
+ case "error":
43
+ return LogLevel.ERROR;
44
+ case "fatal":
45
+ return LogLevel.FATAL;
46
+ case "silent":
47
+ return LogLevel.SILENT;
48
+ default:
49
+ return LogLevel.INFO;
50
+ }
51
+ }, "getLogLevel");
52
+ var isVerbose = /* @__PURE__ */ _chunk64SOMW7Ajs.__name.call(void 0, (label = LogLevelLabel.SILENT) => {
53
+ const logLevel = typeof label === "string" ? getLogLevel(label) : label;
54
+ return logLevel >= LogLevel.DEBUG;
55
+ }, "isVerbose");
56
+
57
+ // ../config/src/constants.ts
58
+ var STORM_DEFAULT_DOCS = "https://docs.stormsoftware.com";
59
+ var STORM_DEFAULT_HOMEPAGE = "https://stormsoftware.com";
60
+ var STORM_DEFAULT_LICENSING = "https://license.stormsoftware.com";
61
+
62
+ // ../config/src/schema.ts
63
+ var _zod = require('zod'); var _zod2 = _interopRequireDefault(_zod);
64
+ var DarkColorSchema = _zod2.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#1d1e22").describe("The dark background color of the workspace");
65
+ var LightColorSchema = _zod2.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#f4f4f5").describe("The light background color of the workspace");
66
+ var BrandColorSchema = _zod2.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#1fb2a6").describe("The primary brand specific color of the workspace");
67
+ var AlternateColorSchema = _zod2.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The alternate brand specific color of the workspace");
68
+ var AccentColorSchema = _zod2.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The secondary brand specific color of the workspace");
69
+ var LinkColorSchema = _zod2.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The color used to display hyperlink text");
70
+ var HelpColorSchema = _zod2.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#8256D0").describe("The second brand specific color of the workspace");
71
+ var SuccessColorSchema = _zod2.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#12B66A").describe("The success color of the workspace");
72
+ var InfoColorSchema = _zod2.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#0070E0").describe("The informational color of the workspace");
73
+ var WarningColorSchema = _zod2.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#fcc419").describe("The warning color of the workspace");
74
+ var DangerColorSchema = _zod2.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#D8314A").describe("The danger color of the workspace");
75
+ var FatalColorSchema = _zod2.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).optional().describe("The fatal color of the workspace");
76
+ var PositiveColorSchema = _zod2.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#4ade80").describe("The positive number color of the workspace");
77
+ var NegativeColorSchema = _zod2.default.string().trim().toLowerCase().regex(/^#([0-9a-f]{3}){1,2}$/i).length(7).default("#ef4444").describe("The negative number color of the workspace");
78
+ var DarkThemeColorConfigSchema = _zod2.default.object({
79
+ foreground: LightColorSchema,
80
+ background: DarkColorSchema,
81
+ brand: BrandColorSchema,
82
+ alternate: AlternateColorSchema,
83
+ accent: AccentColorSchema,
84
+ link: LinkColorSchema,
85
+ help: HelpColorSchema,
86
+ success: SuccessColorSchema,
87
+ info: InfoColorSchema,
88
+ warning: WarningColorSchema,
89
+ danger: DangerColorSchema,
90
+ fatal: FatalColorSchema,
91
+ positive: PositiveColorSchema,
92
+ negative: NegativeColorSchema
93
+ });
94
+ var LightThemeColorConfigSchema = _zod2.default.object({
95
+ foreground: DarkColorSchema,
96
+ background: LightColorSchema,
97
+ brand: BrandColorSchema,
98
+ alternate: AlternateColorSchema,
99
+ accent: AccentColorSchema,
100
+ link: LinkColorSchema,
101
+ help: HelpColorSchema,
102
+ success: SuccessColorSchema,
103
+ info: InfoColorSchema,
104
+ warning: WarningColorSchema,
105
+ danger: DangerColorSchema,
106
+ fatal: FatalColorSchema,
107
+ positive: PositiveColorSchema,
108
+ negative: NegativeColorSchema
109
+ });
110
+ var MultiThemeColorConfigSchema = _zod2.default.object({
111
+ dark: DarkThemeColorConfigSchema,
112
+ light: LightThemeColorConfigSchema
113
+ });
114
+ var SingleThemeColorConfigSchema = _zod2.default.object({
115
+ dark: DarkColorSchema,
116
+ light: LightColorSchema,
117
+ brand: BrandColorSchema,
118
+ alternate: AlternateColorSchema,
119
+ accent: AccentColorSchema,
120
+ link: LinkColorSchema,
121
+ help: HelpColorSchema,
122
+ success: SuccessColorSchema,
123
+ info: InfoColorSchema,
124
+ warning: WarningColorSchema,
125
+ danger: DangerColorSchema,
126
+ fatal: FatalColorSchema,
127
+ positive: PositiveColorSchema,
128
+ negative: NegativeColorSchema
129
+ });
130
+ var RegistryUrlConfigSchema = _zod2.default.string().trim().toLowerCase().url().optional().describe("A remote registry URL used to publish distributable packages");
131
+ var RegistryConfigSchema = _zod2.default.object({
132
+ github: RegistryUrlConfigSchema,
133
+ npm: RegistryUrlConfigSchema,
134
+ cargo: RegistryUrlConfigSchema,
135
+ cyclone: RegistryUrlConfigSchema,
136
+ container: RegistryUrlConfigSchema
137
+ }).default({}).describe("A list of remote registry URLs used by Storm Software");
138
+ var ColorConfigSchema = SingleThemeColorConfigSchema.or(MultiThemeColorConfigSchema).describe("Colors used for various workspace elements");
139
+ var ColorConfigMapSchema = _zod2.default.union([
140
+ _zod2.default.object({
141
+ "base": ColorConfigSchema
142
+ }),
143
+ _zod2.default.record(_zod2.default.string(), ColorConfigSchema)
144
+ ]);
145
+ var WorkspaceBotConfigSchema = _zod2.default.object({
146
+ name: _zod2.default.string().trim().default("Stormie-Bot").describe("The workspace bot user's name (this is the bot that will be used to perform various tasks)"),
147
+ email: _zod2.default.string().trim().email().default("bot@stormsoftware.com").describe("The email of the workspace bot")
148
+ }).describe("The workspace's bot user's config used to automated various operations tasks");
149
+ var WorkspaceDirectoryConfigSchema = _zod2.default.object({
150
+ cache: _zod2.default.string().trim().optional().describe("The directory used to store the environment's cached file data"),
151
+ data: _zod2.default.string().trim().optional().describe("The directory used to store the environment's data files"),
152
+ config: _zod2.default.string().trim().optional().describe("The directory used to store the environment's configuration files"),
153
+ temp: _zod2.default.string().trim().optional().describe("The directory used to store the environment's temp files"),
154
+ log: _zod2.default.string().trim().optional().describe("The directory used to store the environment's temp files"),
155
+ build: _zod2.default.string().trim().default("dist").describe("The directory used to store the workspace's distributable files after a build (relative to the workspace root)")
156
+ }).describe("Various directories used by the workspace to store data, cache, and configuration files");
157
+ var StormConfigSchema = _zod2.default.object({
158
+ $schema: _zod2.default.string().trim().default("https://cdn.jsdelivr.net/npm/@storm-software/config/schemas/storm.schema.json").optional().nullish().describe("The URL to the JSON schema file that describes the Storm configuration file"),
159
+ extends: _zod2.default.string().trim().optional().describe("The path to a base JSON file to use as a configuration preset file"),
160
+ name: _zod2.default.string().trim().toLowerCase().optional().describe("The name of the service/package/scope using this configuration"),
161
+ namespace: _zod2.default.string().trim().toLowerCase().optional().describe("The namespace of the package"),
162
+ organization: _zod2.default.string().trim().default("storm-software").describe("The organization of the workspace"),
163
+ repository: _zod2.default.string().trim().url().optional().describe("The repo URL of the workspace (i.e. GitHub)"),
164
+ license: _zod2.default.string().trim().default("Apache-2.0").describe("The license type of the package"),
165
+ homepage: _zod2.default.string().trim().url().default(STORM_DEFAULT_HOMEPAGE).describe("The homepage of the workspace"),
166
+ docs: _zod2.default.string().trim().url().default(STORM_DEFAULT_DOCS).describe("The base documentation site for the workspace"),
167
+ licensing: _zod2.default.string().trim().url().default(STORM_DEFAULT_LICENSING).describe("The base licensing site for the workspace"),
168
+ branch: _zod2.default.string().trim().default("main").describe("The branch of the workspace"),
169
+ preid: _zod2.default.string().optional().describe("A tag specifying the version pre-release identifier"),
170
+ owner: _zod2.default.string().trim().default("@storm-software/admin").describe("The owner of the package"),
171
+ bot: WorkspaceBotConfigSchema,
172
+ env: _zod2.default.enum([
173
+ "development",
174
+ "staging",
175
+ "production"
176
+ ]).default("production").describe("The current runtime environment name for the package"),
177
+ workspaceRoot: _zod2.default.string().trim().default("").describe("The root directory of the workspace"),
178
+ externalPackagePatterns: _zod2.default.array(_zod2.default.string()).default([]).describe("The build will use these package patterns to determine if they should be external to the bundle"),
179
+ skipCache: _zod2.default.boolean().default(false).describe("Should all known types of workspace caching be skipped?"),
180
+ directories: WorkspaceDirectoryConfigSchema,
181
+ packageManager: _zod2.default.enum([
182
+ "npm",
183
+ "yarn",
184
+ "pnpm",
185
+ "bun"
186
+ ]).default("npm").describe("The JavaScript/TypeScript package manager used by the repository"),
187
+ timezone: _zod2.default.string().trim().default("America/New_York").describe("The default timezone of the workspace"),
188
+ locale: _zod2.default.string().trim().default("en-US").describe("The default locale of the workspace"),
189
+ logLevel: _zod2.default.enum([
190
+ "silent",
191
+ "fatal",
192
+ "error",
193
+ "warn",
194
+ "success",
195
+ "info",
196
+ "debug",
197
+ "trace",
198
+ "all"
199
+ ]).default("info").describe("The log level used to filter out lower priority log messages. If not provided, this is defaulted using the `environment` config value (if `environment` is set to `production` then `level` is `error`, else `level` is `debug`)."),
200
+ registry: RegistryConfigSchema,
201
+ configFile: _zod2.default.string().trim().nullable().default(null).describe("The filepath of the Storm config. When this field is null, no config file was found in the current workspace."),
202
+ colors: ColorConfigSchema.or(ColorConfigMapSchema).describe("Storm theme config values used for styling various package elements"),
203
+ extensions: _zod2.default.record(_zod2.default.any()).optional().default({}).describe("Configuration of each used extension")
204
+ }).describe("Storm Workspace config values used during various dev-ops processes. This type is a combination of the StormPackageConfig and StormProject types. It represents the config of the entire monorepo.");
205
+
206
+ // ../config-tools/src/utilities/get-default-config.ts
207
+ var _fs = require('fs');
208
+ var _path = require('path');
209
+ var DEFAULT_COLOR_CONFIG = {
210
+ "light": {
211
+ "background": "#fafafa",
212
+ "foreground": "#1d1e22",
213
+ "brand": "#1fb2a6",
214
+ "alternate": "#db2777",
215
+ "help": "#5C4EE5",
216
+ "success": "#087f5b",
217
+ "info": "#0550ae",
218
+ "warning": "#e3b341",
219
+ "danger": "#D8314A",
220
+ "positive": "#22c55e",
221
+ "negative": "#dc2626"
222
+ },
223
+ "dark": {
224
+ "background": "#1d1e22",
225
+ "foreground": "#cbd5e1",
226
+ "brand": "#2dd4bf",
227
+ "alternate": "#db2777",
228
+ "help": "#818cf8",
229
+ "success": "#10b981",
230
+ "info": "#58a6ff",
231
+ "warning": "#f3d371",
232
+ "danger": "#D8314A",
233
+ "positive": "#22c55e",
234
+ "negative": "#dc2626"
235
+ }
236
+ };
237
+
238
+ // ../config-tools/src/logger/chalk.ts
239
+ var _chalk2 = require('chalk'); var _chalk3 = _interopRequireDefault(_chalk2);
240
+ var chalkDefault = {
241
+ hex: /* @__PURE__ */ _chunk64SOMW7Ajs.__name.call(void 0, (_) => (message) => message, "hex"),
242
+ bgHex: /* @__PURE__ */ _chunk64SOMW7Ajs.__name.call(void 0, (_) => ({
243
+ whiteBright: /* @__PURE__ */ _chunk64SOMW7Ajs.__name.call(void 0, (message) => message, "whiteBright")
244
+ }), "bgHex"),
245
+ whiteBright: /* @__PURE__ */ _chunk64SOMW7Ajs.__name.call(void 0, (message) => message, "whiteBright"),
246
+ gray: /* @__PURE__ */ _chunk64SOMW7Ajs.__name.call(void 0, (message) => message, "gray"),
247
+ bold: {
248
+ hex: /* @__PURE__ */ _chunk64SOMW7Ajs.__name.call(void 0, (_) => (message) => message, "hex"),
249
+ bgHex: /* @__PURE__ */ _chunk64SOMW7Ajs.__name.call(void 0, (_) => ({
250
+ whiteBright: /* @__PURE__ */ _chunk64SOMW7Ajs.__name.call(void 0, (message) => message, "whiteBright")
251
+ }), "bgHex"),
252
+ whiteBright: /* @__PURE__ */ _chunk64SOMW7Ajs.__name.call(void 0, (message) => message, "whiteBright")
253
+ },
254
+ dim: {
255
+ hex: /* @__PURE__ */ _chunk64SOMW7Ajs.__name.call(void 0, (_) => (message) => message, "hex"),
256
+ gray: /* @__PURE__ */ _chunk64SOMW7Ajs.__name.call(void 0, (message) => message, "gray")
257
+ }
258
+ };
259
+ var getChalk = /* @__PURE__ */ _chunk64SOMW7Ajs.__name.call(void 0, () => {
260
+ let _chalk = _chalk3.default;
261
+ if (!_optionalChain([_chalk, 'optionalAccess', _2 => _2.hex]) || !_optionalChain([_chalk, 'optionalAccess', _3 => _3.bold, 'optionalAccess', _4 => _4.hex]) || !_optionalChain([_chalk, 'optionalAccess', _5 => _5.bgHex]) || !_optionalChain([_chalk, 'optionalAccess', _6 => _6.whiteBright])) {
262
+ _chalk = chalkDefault;
263
+ }
264
+ return _chalk;
265
+ }, "getChalk");
266
+
267
+ // ../config-tools/src/logger/is-unicode-supported.ts
268
+ var _process = require('process'); var _process2 = _interopRequireDefault(_process);
269
+ function isUnicodeSupported() {
270
+ const { env } = _process2.default;
271
+ const { TERM, TERM_PROGRAM } = env;
272
+ if (_process2.default.platform !== "win32") {
273
+ return TERM !== "linux";
274
+ }
275
+ return Boolean(env.WT_SESSION) || // Windows Terminal
276
+ Boolean(env.TERMINUS_SUBLIME) || // Terminus (<0.2.27)
277
+ env.ConEmuTask === "{cmd::Cmder}" || // ConEmu and cmder
278
+ TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
279
+ }
280
+ _chunk64SOMW7Ajs.__name.call(void 0, isUnicodeSupported, "isUnicodeSupported");
281
+
282
+ // ../config-tools/src/logger/console-icons.ts
283
+ var useIcon = /* @__PURE__ */ _chunk64SOMW7Ajs.__name.call(void 0, (c, fallback) => isUnicodeSupported() ? c : fallback, "useIcon");
284
+ var CONSOLE_ICONS = {
285
+ [LogLevelLabel.ERROR]: useIcon("\u2718", "\xD7"),
286
+ [LogLevelLabel.FATAL]: useIcon("\u{1F480}", "\xD7"),
287
+ [LogLevelLabel.WARN]: useIcon("\u26A0", "\u203C"),
288
+ [LogLevelLabel.INFO]: useIcon("\u2139", "i"),
289
+ [LogLevelLabel.SUCCESS]: useIcon("\u2714", "\u221A"),
290
+ [LogLevelLabel.DEBUG]: useIcon("\u{1F6E0}", "D"),
291
+ [LogLevelLabel.TRACE]: useIcon("\u2709", "\u2192")
292
+ };
293
+
294
+ // ../config-tools/src/logger/format-timestamp.ts
295
+ var formatTimestamp = /* @__PURE__ */ _chunk64SOMW7Ajs.__name.call(void 0, (date = /* @__PURE__ */ new Date()) => {
296
+ return `${date.toLocaleDateString()} ${date.toLocaleTimeString()}`;
297
+ }, "formatTimestamp");
298
+
299
+ // ../config-tools/src/logger/console.ts
300
+ var getLogFn = /* @__PURE__ */ _chunk64SOMW7Ajs.__name.call(void 0, (logLevel = LogLevel.INFO, config = {}) => {
301
+ const _chalk = getChalk();
302
+ const colors = !_optionalChain([config, 'access', _7 => _7.colors, 'optionalAccess', _8 => _8.dark]) && !_optionalChain([config, 'access', _9 => _9.colors, 'optionalAccess', _10 => _10["base"]]) && !_optionalChain([config, 'access', _11 => _11.colors, 'optionalAccess', _12 => _12["base"], 'optionalAccess', _13 => _13.dark]) ? DEFAULT_COLOR_CONFIG : _optionalChain([config, 'access', _14 => _14.colors, 'optionalAccess', _15 => _15.dark]) && typeof config.colors.dark === "string" ? config.colors : _optionalChain([config, 'access', _16 => _16.colors, 'optionalAccess', _17 => _17["base"], 'optionalAccess', _18 => _18.dark]) && typeof config.colors["base"].dark === "string" ? config.colors["base"].dark : _optionalChain([config, 'access', _19 => _19.colors, 'optionalAccess', _20 => _20["base"]]) ? _optionalChain([config, 'access', _21 => _21.colors, 'optionalAccess', _22 => _22["base"]]) : DEFAULT_COLOR_CONFIG;
303
+ const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
304
+ if (typeof logLevel === "number" && (logLevel >= getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT) || typeof logLevel === "string" && getLogLevel(logLevel) >= getLogLevel(configLogLevel)) {
305
+ return (_) => {
306
+ };
307
+ }
308
+ if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel || typeof logLevel === "string" && LogLevel.FATAL >= getLogLevel(logLevel)) {
309
+ return (message) => {
310
+ console.error(`
311
+ ${_chalk.gray(formatTimestamp())} ${_chalk.bold.hex(_nullishCoalesce(colors.fatal, () => ( "#7d1a1a")))(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal]`)} ${_chalk.hex(_nullishCoalesce(colors.fatal, () => ( "#7d1a1a")))(formatLogMessage(message))}
312
+ `);
313
+ };
314
+ }
315
+ if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel || typeof logLevel === "string" && LogLevel.ERROR >= getLogLevel(logLevel)) {
316
+ return (message) => {
317
+ console.error(`
318
+ ${_chalk.gray(formatTimestamp())} ${_chalk.bold.hex(_nullishCoalesce(colors.danger, () => ( "#f85149")))(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error]`)} ${_chalk.hex(_nullishCoalesce(colors.danger, () => ( "#f85149")))(formatLogMessage(message))}
319
+ `);
320
+ };
321
+ }
322
+ if (typeof logLevel === "number" && LogLevel.WARN >= logLevel || typeof logLevel === "string" && LogLevel.WARN >= getLogLevel(logLevel)) {
323
+ return (message) => {
324
+ console.warn(`
325
+ ${_chalk.gray(formatTimestamp())} ${_chalk.bold.hex(_nullishCoalesce(colors.warning, () => ( "#e3b341")))(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn]`)} ${_chalk.hex(_nullishCoalesce(colors.warning, () => ( "#e3b341")))(formatLogMessage(message))}
326
+ `);
327
+ };
328
+ }
329
+ if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel || typeof logLevel === "string" && LogLevel.SUCCESS >= getLogLevel(logLevel)) {
330
+ return (message) => {
331
+ console.info(`
332
+ ${_chalk.gray(formatTimestamp())} ${_chalk.bold.hex(_nullishCoalesce(colors.success, () => ( "#56d364")))(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success]`)} ${_chalk.hex(_nullishCoalesce(colors.success, () => ( "#56d364")))(formatLogMessage(message))}
333
+ `);
334
+ };
335
+ }
336
+ if (typeof logLevel === "number" && LogLevel.INFO >= logLevel || typeof logLevel === "string" && LogLevel.INFO >= getLogLevel(logLevel)) {
337
+ return (message) => {
338
+ console.info(`
339
+ ${_chalk.gray(formatTimestamp())} ${_chalk.bold.hex(_nullishCoalesce(colors.info, () => ( "#58a6ff")))(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info]`)} ${_chalk.hex(_nullishCoalesce(colors.info, () => ( "#58a6ff")))(formatLogMessage(message))}
340
+ `);
341
+ };
342
+ }
343
+ if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel || typeof logLevel === "string" && LogLevel.TRACE >= getLogLevel(logLevel)) {
344
+ return (message) => {
345
+ console.debug(`
346
+ ${_chalk.gray(formatTimestamp())} ${_chalk.bold.hex(_nullishCoalesce(colors.brand, () => ( "#1fb2a6")))(`[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Debug]`)} ${_chalk.hex(_nullishCoalesce(colors.brand, () => ( "#1fb2a6")))(formatLogMessage(message))}
347
+ `);
348
+ };
349
+ }
350
+ return (message) => {
351
+ console.log(`
352
+ ${_chalk.gray(formatTimestamp())} ${_chalk.bold.hex(_nullishCoalesce(colors.brand, () => ( "#1fb2a6")))(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System]`)} ${_chalk.hex(_nullishCoalesce(colors.brand, () => ( "#1fb2a6")))(formatLogMessage(message))}
353
+ `);
354
+ };
355
+ }, "getLogFn");
356
+ var writeError = /* @__PURE__ */ _chunk64SOMW7Ajs.__name.call(void 0, (message, config) => getLogFn(LogLevel.ERROR, config)(message), "writeError");
357
+ var writeTrace = /* @__PURE__ */ _chunk64SOMW7Ajs.__name.call(void 0, (message, config) => getLogFn(LogLevel.TRACE, config)(message), "writeTrace");
358
+ var MAX_DEPTH = 4;
359
+ var formatLogMessage = /* @__PURE__ */ _chunk64SOMW7Ajs.__name.call(void 0, (message, options = {}, depth = 0) => {
360
+ if (depth > MAX_DEPTH) {
361
+ return "<max depth>";
362
+ }
363
+ const prefix = _nullishCoalesce(options.prefix, () => ( "-"));
364
+ const skip = _nullishCoalesce(options.skip, () => ( []));
365
+ return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
366
+ ${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, {
367
+ prefix: `${prefix}-`,
368
+ skip
369
+ }, depth + 1)}`).join("\n")}` : typeof message === "object" ? `
370
+ ${Object.keys(message).filter((key) => !skip.includes(key)).map((key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(message[key], {
371
+ prefix: `${prefix}-`,
372
+ skip
373
+ }, depth + 1) : message[key]}`).join("\n")}` : message;
374
+ }, "formatLogMessage");
375
+ var _isFunction = /* @__PURE__ */ _chunk64SOMW7Ajs.__name.call(void 0, (value) => {
376
+ try {
377
+ return value instanceof Function || typeof value === "function" || !!(_optionalChain([value, 'optionalAccess', _23 => _23.constructor]) && _optionalChain([value, 'optionalAccess', _24 => _24.call]) && _optionalChain([value, 'optionalAccess', _25 => _25.apply]));
378
+ } catch (e) {
379
+ return false;
380
+ }
381
+ }, "_isFunction");
382
+
383
+
384
+
385
+
386
+
387
+ exports.isVerbose = isVerbose; exports.writeError = writeError; exports.writeTrace = writeTrace;
@@ -0,0 +1,34 @@
1
+ import {
2
+ writeError,
3
+ writeTrace
4
+ } from "./chunk-CVBHL6A3.mjs";
5
+ import {
6
+ __name,
7
+ getOutputFile
8
+ } from "./chunk-NWAI6PTH.mjs";
9
+
10
+ // src/generators/json-schema.ts
11
+ import { writeFile } from "node:fs/promises";
12
+ function generateJsonSchemaFile(schema, file, config) {
13
+ try {
14
+ const jsonSchema = getOutputFile(file, "json");
15
+ writeTrace(`Writing JSON schema file ${jsonSchema}`, config);
16
+ return writeFile(jsonSchema, JSON.stringify(schema, null, 2));
17
+ } catch (error) {
18
+ writeError(`Error writing JSON schema file for ${file.name}
19
+
20
+ Error:
21
+ ${error?.message ? error.message : JSON.stringify(error)}${error?.stack ? `
22
+ Stack Trace: ${error.stack}` : ""}
23
+
24
+ Parsed schema:
25
+ ${JSON.stringify(schema)}
26
+ `, config);
27
+ throw error;
28
+ }
29
+ }
30
+ __name(generateJsonSchemaFile, "generateJsonSchemaFile");
31
+
32
+ export {
33
+ generateJsonSchemaFile
34
+ };
@@ -0,0 +1,69 @@
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 _chunkPSNCUPEFjs = require('./chunk-PSNCUPEF.js');
5
+
6
+
7
+
8
+ var _chunk64SOMW7Ajs = require('./chunk-64SOMW7A.js');
9
+
10
+ // src/generators/markdown.ts
11
+ var _promises = require('fs/promises');
12
+ function generateMarkdown(schema) {
13
+ return `
14
+ <!-- Generated by @storm-software/untyped -->
15
+ <!-- Do not edit this file directly -->
16
+
17
+ ${generateMarkdownLevel(schema, schema.title || "", "#").join("\n")}
18
+
19
+ `;
20
+ }
21
+ _chunk64SOMW7Ajs.__name.call(void 0, generateMarkdown, "generateMarkdown");
22
+ function generateMarkdownLevel(schema, title, level) {
23
+ const lines = [];
24
+ lines.push(`${level} ${title}`);
25
+ if (schema.type === "object") {
26
+ for (const key in schema.properties) {
27
+ const val = schema.properties[key];
28
+ lines.push("", ...generateMarkdownLevel(val, `\`${key}\``, level + "#"));
29
+ }
30
+ return lines;
31
+ }
32
+ lines.push(`- **Type**: \`${schema.markdownType || schema.tsType || schema.type}\``);
33
+ if ("default" in schema) {
34
+ lines.push(`- **Default**: \`${JSON.stringify(schema.default)}\``);
35
+ }
36
+ lines.push("");
37
+ if (schema.title) {
38
+ lines.push("> " + schema.title, "");
39
+ }
40
+ if (schema.description) {
41
+ lines.push("", schema.description, "");
42
+ }
43
+ return lines;
44
+ }
45
+ _chunk64SOMW7Ajs.__name.call(void 0, generateMarkdownLevel, "generateMarkdownLevel");
46
+ function generateMarkdownFile(schema, file, config) {
47
+ try {
48
+ const declarations = _chunk64SOMW7Ajs.getOutputFile.call(void 0, file, "md");
49
+ _chunkPSNCUPEFjs.writeTrace.call(void 0, `Writing type markdown file ${declarations}`, config);
50
+ return _promises.writeFile.call(void 0, declarations, generateMarkdown(schema));
51
+ } catch (error) {
52
+ _chunkPSNCUPEFjs.writeError.call(void 0, `Error writing markdown file for ${file.name}
53
+
54
+ Error:
55
+ ${_optionalChain([error, 'optionalAccess', _ => _.message]) ? error.message : JSON.stringify(error)}${_optionalChain([error, 'optionalAccess', _2 => _2.stack]) ? `
56
+ Stack Trace: ${error.stack}` : ""}
57
+
58
+ Parsed schema:
59
+ ${JSON.stringify(schema)}
60
+ `, config);
61
+ throw error;
62
+ }
63
+ }
64
+ _chunk64SOMW7Ajs.__name.call(void 0, generateMarkdownFile, "generateMarkdownFile");
65
+
66
+
67
+
68
+
69
+ exports.generateMarkdown = generateMarkdown; exports.generateMarkdownFile = generateMarkdownFile;
@@ -0,0 +1 @@
1
+ "use strict";
@@ -0,0 +1,73 @@
1
+ import {
2
+ generateDeclarationFile
3
+ } from "./chunk-IZL7IEIU.mjs";
4
+ import {
5
+ generateJsonSchemaFile
6
+ } from "./chunk-RAX4M7XF.mjs";
7
+ import {
8
+ generateMarkdownFile
9
+ } from "./chunk-CSRZXE4P.mjs";
10
+ import {
11
+ isVerbose,
12
+ writeError,
13
+ writeTrace
14
+ } from "./chunk-CVBHL6A3.mjs";
15
+ import {
16
+ __name,
17
+ joinPaths
18
+ } from "./chunk-NWAI6PTH.mjs";
19
+
20
+ // src/generate.ts
21
+ import { glob } from "glob";
22
+ import { loadSchema } from "untyped/loader";
23
+ var getGenerateAction = /* @__PURE__ */ __name((config) => async (options) => {
24
+ const files = await glob(options.entry, {
25
+ ignore: [
26
+ "**/{*.stories.tsx,*.stories.ts,*.spec.tsx,*.spec.ts}",
27
+ "**/dist/**",
28
+ "**/tmp/**",
29
+ "**/node_modules/**",
30
+ "**/.git/**",
31
+ "**/.cache/**",
32
+ "**/.nx/**"
33
+ ],
34
+ withFileTypes: true,
35
+ cwd: config.workspaceRoot
36
+ });
37
+ const cache = !Boolean(process.env.CI) && !Boolean(process.env.STORM_CI) && !config.skipCache;
38
+ writeTrace(cache ? `Skipping jiti cache because ${Boolean(process.env.CI) ? '`process.env.CI` is set to "true"' : Boolean(process.env.STORM_CI) ? '`process.env.STORM_CI` is set to "true"' : config.skipCache ? "`skipCache` in the Storm configuration file is set to `true`" : "<INVALID REASON>"}` : "Will use jiti cache while parsing schema files", config);
39
+ await Promise.all(files.map(async (file) => {
40
+ writeTrace(`Generating files for schema file: ${joinPaths(file.parentPath, file.name)}`, config);
41
+ let schema;
42
+ try {
43
+ schema = await loadSchema(joinPaths(file.parentPath, file.name), {
44
+ jiti: {
45
+ debug: isVerbose(config.logLevel),
46
+ fsCache: cache && joinPaths(config.directories.cache || "node_modules/.cache", "storm", "untyped"),
47
+ moduleCache: cache,
48
+ interopDefault: true
49
+ }
50
+ });
51
+ } catch (error) {
52
+ writeError(`Error while parsing schema file: ${joinPaths(file.parentPath, file.name)}
53
+
54
+ Error:
55
+ ${error?.message ? error.message : JSON.stringify(error)}${error?.stack ? `
56
+ Stack Trace: ${error.stack}` : ""}
57
+
58
+ Parsed schema:
59
+ ${JSON.stringify(schema)}
60
+ `, config);
61
+ throw error;
62
+ }
63
+ const promises = [];
64
+ promises.push(generateDeclarationFile(schema, file, config));
65
+ promises.push(generateMarkdownFile(schema, file, config));
66
+ promises.push(generateJsonSchemaFile(schema, file, config));
67
+ return Promise.all(promises);
68
+ }));
69
+ }, "getGenerateAction");
70
+
71
+ export {
72
+ getGenerateAction
73
+ };
File without changes
@@ -0,0 +1,10 @@
1
+ import { S as StormConfig } from './types-DkqO6Ujr.mjs';
2
+ import 'zod';
3
+
4
+ declare const getGenerateAction: (config: StormConfig) => (options: {
5
+ entry: string | string[];
6
+ outputPath: string;
7
+ jsonSchema: string;
8
+ }) => Promise<void>;
9
+
10
+ export { getGenerateAction };