@storm-software/git-tools 2.131.127 → 2.131.128

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.
Files changed (66) hide show
  1. package/README.md +1 -1
  2. package/bin/{chunk-GAHICIOD.js → chunk-A5X7CY3W.js} +3 -3
  3. package/bin/{chunk-GAHICIOD.js.map → chunk-A5X7CY3W.js.map} +1 -1
  4. package/bin/{chunk-ZBZINLOA.js → chunk-AOZSGQGA.js} +3 -3
  5. package/bin/{chunk-ZBZINLOA.js.map → chunk-AOZSGQGA.js.map} +1 -1
  6. package/bin/chunk-FOMBLMLH.js +2073 -0
  7. package/bin/chunk-FOMBLMLH.js.map +1 -0
  8. package/bin/{chunk-B5CZCP2Y.cjs → chunk-GT7HITVF.cjs} +4 -4
  9. package/bin/{chunk-B5CZCP2Y.cjs.map → chunk-GT7HITVF.cjs.map} +1 -1
  10. package/bin/{chunk-ZL2JPPJF.cjs → chunk-IHDSESSE.cjs} +4 -4
  11. package/bin/{chunk-ZL2JPPJF.cjs.map → chunk-IHDSESSE.cjs.map} +1 -1
  12. package/bin/{chunk-SASCLX6I.js → chunk-IIH7F7OZ.js} +3 -3
  13. package/bin/{chunk-SASCLX6I.js.map → chunk-IIH7F7OZ.js.map} +1 -1
  14. package/bin/{chunk-KFRB3UCF.js → chunk-JBHMFR7F.js} +3 -3
  15. package/bin/{chunk-KFRB3UCF.js.map → chunk-JBHMFR7F.js.map} +1 -1
  16. package/bin/{chunk-KJMWPKRH.cjs → chunk-JYYYVLIU.cjs} +4 -4
  17. package/bin/{chunk-KJMWPKRH.cjs.map → chunk-JYYYVLIU.cjs.map} +1 -1
  18. package/bin/{chunk-MUNEGKNC.cjs → chunk-ML5MZIGJ.cjs} +5 -5
  19. package/bin/{chunk-MUNEGKNC.cjs.map → chunk-ML5MZIGJ.cjs.map} +1 -1
  20. package/bin/{chunk-NNIW4L2Q.js → chunk-NG23E43K.js} +3 -3
  21. package/bin/{chunk-NNIW4L2Q.js.map → chunk-NG23E43K.js.map} +1 -1
  22. package/bin/{chunk-2NTFR3EF.cjs → chunk-QBI7KQ6A.cjs} +6 -6
  23. package/bin/{chunk-2NTFR3EF.cjs.map → chunk-QBI7KQ6A.cjs.map} +1 -1
  24. package/bin/{chunk-VIFL2F7H.js → chunk-SHH572XU.js} +3 -3
  25. package/bin/{chunk-VIFL2F7H.js.map → chunk-SHH572XU.js.map} +1 -1
  26. package/bin/{chunk-NZ4HDNJ7.cjs → chunk-SZFP3TKI.cjs} +4 -4
  27. package/bin/{chunk-NZ4HDNJ7.cjs.map → chunk-SZFP3TKI.cjs.map} +1 -1
  28. package/bin/chunk-TOLGVHZM.cjs +2116 -0
  29. package/bin/chunk-TOLGVHZM.cjs.map +1 -0
  30. package/bin/{chunk-MSQDEBW3.js → chunk-WUN4N3D7.js} +3 -3
  31. package/bin/{chunk-MSQDEBW3.js.map → chunk-WUN4N3D7.js.map} +1 -1
  32. package/bin/{chunk-IXUKWNVT.cjs → chunk-ZJN2D7NE.cjs} +4 -4
  33. package/bin/{chunk-IXUKWNVT.cjs.map → chunk-ZJN2D7NE.cjs.map} +1 -1
  34. package/bin/git.cjs +185 -195
  35. package/bin/git.cjs.map +1 -1
  36. package/bin/git.js +46 -54
  37. package/bin/git.js.map +1 -1
  38. package/bin/post-checkout.cjs +7 -7
  39. package/bin/post-checkout.js +2 -2
  40. package/bin/post-commit.cjs +7 -7
  41. package/bin/post-commit.js +2 -2
  42. package/bin/post-merge.cjs +7 -7
  43. package/bin/post-merge.js +2 -2
  44. package/bin/pre-commit.cjs +7 -7
  45. package/bin/pre-commit.js +2 -2
  46. package/bin/pre-install.cjs +7 -7
  47. package/bin/pre-install.js +2 -2
  48. package/bin/pre-push.cjs +7 -7
  49. package/bin/pre-push.js +2 -2
  50. package/bin/prepare.cjs +7 -7
  51. package/bin/prepare.js +2 -2
  52. package/bin/version-warning.cjs +5 -5
  53. package/bin/version-warning.js +1 -1
  54. package/dist/chunk-52Z6PKZI.js +2412 -0
  55. package/dist/chunk-U5IGP2SZ.cjs +2454 -0
  56. package/dist/index.cjs +18 -18
  57. package/dist/index.js +1 -1
  58. package/dist/release/config.cjs +18 -18
  59. package/dist/release/config.js +1 -1
  60. package/package.json +10 -14
  61. package/bin/chunk-DGRFGD2R.cjs +0 -3578
  62. package/bin/chunk-DGRFGD2R.cjs.map +0 -1
  63. package/bin/chunk-ZW42VDY5.js +0 -3554
  64. package/bin/chunk-ZW42VDY5.js.map +0 -1
  65. package/dist/chunk-IVBFLZSL.cjs +0 -3863
  66. package/dist/chunk-J5FHPMMG.js +0 -3840
@@ -1,3840 +0,0 @@
1
- import { DEFAULT_MONOREPO_COMMIT_QUESTIONS } from './chunk-OMWWQPRY.js';
2
- import { DEFAULT_COMMIT_TYPES } from './chunk-4T5NCWMG.js';
3
- import { writeWarning, formatLogMessage, writeTrace, getLogLevel, LogLevel, getLogLevelLabel } from './chunk-PPBPJTXT.js';
4
- import defu3 from 'defu';
5
- import { existsSync } from 'fs';
6
- import { readNxJson } from 'nx/src/config/nx-json';
7
- import { findMatchingProjects } from 'nx/src/utils/find-matching-projects';
8
- import { loadConfig } from 'c12';
9
- import { existsSync as existsSync$1 } from 'node:fs';
10
- import { join } from 'node:path';
11
- import { readFile } from 'node:fs/promises';
12
- import axios2 from 'axios';
13
- import DefaultChangelogRenderer from 'nx/release/changelog-renderer';
14
- import { DEFAULT_CONVENTIONAL_COMMITS_CONFIG } from 'nx/src/command-line/release/config/conventional-commits';
15
- import { major } from 'semver';
16
- import '@nx/devkit';
17
- import 'chalk';
18
- import 'nx/src/command-line/release/utils/print-changes';
19
- import 'nx/src/command-line/release/utils/shared';
20
- import 'nx/src/tasks-runner/utils';
21
- import 'prettier';
22
- import 'node:child_process';
23
- import 'node:os';
24
- import 'nx/src/command-line/release/utils/remote-release-clients/github';
25
- import 'yaml';
26
- import 'nx/src/command-line/release/utils/exec-command';
27
- import 'nx/src/command-line/release/utils/git';
28
-
29
- // ../config-tools/src/utilities/correct-paths.ts
30
- var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
31
- function normalizeWindowsPath(input = "") {
32
- if (!input) {
33
- return input;
34
- }
35
- return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
36
- }
37
- var _UNC_REGEX = /^[/\\]{2}/;
38
- var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
39
- var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
40
- var correctPaths = function(path) {
41
- if (!path || path.length === 0) {
42
- return ".";
43
- }
44
- path = normalizeWindowsPath(path);
45
- const isUNCPath = path?.match(_UNC_REGEX);
46
- const isPathAbsolute = isAbsolute(path);
47
- const trailingSeparator = path[path.length - 1] === "/";
48
- path = normalizeString(path, !isPathAbsolute);
49
- if (path.length === 0) {
50
- if (isPathAbsolute) {
51
- return "/";
52
- }
53
- return trailingSeparator ? "./" : ".";
54
- }
55
- if (trailingSeparator) {
56
- path += "/";
57
- }
58
- if (_DRIVE_LETTER_RE.test(path)) {
59
- path += "/";
60
- }
61
- if (isUNCPath) {
62
- if (!isPathAbsolute) {
63
- return `//./${path}`;
64
- }
65
- return `//${path}`;
66
- }
67
- return isPathAbsolute && !isAbsolute(path) ? `/${path}` : path;
68
- };
69
- var joinPaths = function(...segments) {
70
- let path = "";
71
- for (const seg of segments) {
72
- if (!seg) {
73
- continue;
74
- }
75
- if (path.length > 0) {
76
- const pathTrailing = path[path.length - 1] === "/";
77
- const segLeading = seg[0] === "/";
78
- const both = pathTrailing && segLeading;
79
- if (both) {
80
- path += seg.slice(1);
81
- } else {
82
- path += pathTrailing || segLeading ? seg : `/${seg}`;
83
- }
84
- } else {
85
- path += seg;
86
- }
87
- }
88
- return correctPaths(path);
89
- };
90
- function normalizeString(path, allowAboveRoot) {
91
- let res = "";
92
- let lastSegmentLength = 0;
93
- let lastSlash = -1;
94
- let dots = 0;
95
- let char = null;
96
- for (let index = 0; index <= path.length; ++index) {
97
- if (index < path.length) {
98
- char = path[index];
99
- } else if (char === "/") {
100
- break;
101
- } else {
102
- char = "/";
103
- }
104
- if (char === "/") {
105
- if (lastSlash === index - 1 || dots === 1) ; else if (dots === 2) {
106
- if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
107
- if (res.length > 2) {
108
- const lastSlashIndex = res.lastIndexOf("/");
109
- if (lastSlashIndex === -1) {
110
- res = "";
111
- lastSegmentLength = 0;
112
- } else {
113
- res = res.slice(0, lastSlashIndex);
114
- lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
115
- }
116
- lastSlash = index;
117
- dots = 0;
118
- continue;
119
- } else if (res.length > 0) {
120
- res = "";
121
- lastSegmentLength = 0;
122
- lastSlash = index;
123
- dots = 0;
124
- continue;
125
- }
126
- }
127
- if (allowAboveRoot) {
128
- res += res.length > 0 ? "/.." : "..";
129
- lastSegmentLength = 2;
130
- }
131
- } else {
132
- if (res.length > 0) {
133
- res += `/${path.slice(lastSlash + 1, index)}`;
134
- } else {
135
- res = path.slice(lastSlash + 1, index);
136
- }
137
- lastSegmentLength = index - lastSlash - 1;
138
- }
139
- lastSlash = index;
140
- dots = 0;
141
- } else if (char === "." && dots !== -1) {
142
- ++dots;
143
- } else {
144
- dots = -1;
145
- }
146
- }
147
- return res;
148
- }
149
- var isAbsolute = function(p) {
150
- return _IS_ABSOLUTE_RE.test(p);
151
- };
152
-
153
- // ../package-constants/src/tags.ts
154
- var ProjectTagConstants = {
155
- Language: {
156
- TAG_ID: "language",
157
- TYPESCRIPT: "typescript",
158
- RUST: "rust"
159
- }};
160
- var formatProjectTag = (variant, value) => {
161
- return `${variant}:${value}`;
162
- };
163
- var hasProjectTag = (project, variant) => {
164
- project.tags = project.tags ?? [];
165
- const prefix = formatProjectTag(variant, "");
166
- return project.tags.some(
167
- (tag) => tag.startsWith(prefix) && tag.length > prefix.length
168
- );
169
- };
170
- var getProjectTag = (project, variant) => {
171
- if (!hasProjectTag(project, variant)) {
172
- return void 0;
173
- }
174
- project.tags = project.tags ?? [];
175
- const prefix = formatProjectTag(variant, "");
176
- const tag = project.tags.find((tag2) => tag2.startsWith(prefix));
177
- return tag?.replace(prefix, "");
178
- };
179
- var isEqualProjectTag = (project, variant, value) => {
180
- const tag = getProjectTag(project, variant);
181
- return !!(tag && tag?.toUpperCase() === value.toUpperCase());
182
- };
183
-
184
- // src/utilities/omit.ts
185
- function omit(obj, keys) {
186
- const result = { ...obj };
187
- for (let i = 0; i < keys.length; i++) {
188
- const key = keys[i];
189
- if (key && key in result) {
190
- delete result[key];
191
- }
192
- }
193
- return result;
194
- }
195
- var MAX_PATH_SEARCH_DEPTH = 30;
196
- var depth = 0;
197
- function findFolderUp(startPath, endFileNames = [], endDirectoryNames = []) {
198
- const _startPath = startPath ?? process.cwd();
199
- if (endDirectoryNames.some(
200
- (endDirName) => existsSync$1(join(_startPath, endDirName))
201
- )) {
202
- return _startPath;
203
- }
204
- if (endFileNames.some((endFileName) => existsSync$1(join(_startPath, endFileName)))) {
205
- return _startPath;
206
- }
207
- if (_startPath !== "/" && depth++ < MAX_PATH_SEARCH_DEPTH) {
208
- const parent = join(_startPath, "..");
209
- return findFolderUp(parent, endFileNames, endDirectoryNames);
210
- }
211
- return void 0;
212
- }
213
-
214
- // ../config-tools/src/utilities/find-workspace-root.ts
215
- var rootFiles = [
216
- "storm-workspace.json",
217
- "storm-workspace.yaml",
218
- "storm-workspace.yml",
219
- "storm-workspace.js",
220
- "storm-workspace.ts",
221
- ".storm-workspace.json",
222
- ".storm-workspace.yaml",
223
- ".storm-workspace.yml",
224
- ".storm-workspace.js",
225
- ".storm-workspace.ts",
226
- "lerna.json",
227
- "nx.json",
228
- "turbo.json",
229
- "npm-workspace.json",
230
- "yarn-workspace.json",
231
- "pnpm-workspace.json",
232
- "npm-workspace.yaml",
233
- "yarn-workspace.yaml",
234
- "pnpm-workspace.yaml",
235
- "npm-workspace.yml",
236
- "yarn-workspace.yml",
237
- "pnpm-workspace.yml",
238
- "npm-lock.json",
239
- "yarn-lock.json",
240
- "pnpm-lock.json",
241
- "npm-lock.yaml",
242
- "yarn-lock.yaml",
243
- "pnpm-lock.yaml",
244
- "npm-lock.yml",
245
- "yarn-lock.yml",
246
- "pnpm-lock.yml",
247
- "bun.lockb",
248
- "bun.lock",
249
- "bunfig.toml"
250
- ];
251
- var rootDirectories = [
252
- ".storm-workspace",
253
- ".nx",
254
- ".git",
255
- ".github",
256
- ".vscode",
257
- ".verdaccio"
258
- ];
259
- function findWorkspaceRootSafe(pathInsideMonorepo) {
260
- if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
261
- return correctPaths(
262
- process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH
263
- );
264
- }
265
- return correctPaths(
266
- findFolderUp(
267
- pathInsideMonorepo ?? process.cwd(),
268
- rootFiles,
269
- rootDirectories
270
- )
271
- );
272
- }
273
- function findWorkspaceRoot(pathInsideMonorepo) {
274
- const result = findWorkspaceRootSafe(pathInsideMonorepo);
275
- if (!result) {
276
- throw new Error(
277
- `Cannot find workspace root upwards from known path. Files search list includes:
278
- ${rootFiles.join(
279
- "\n"
280
- )}
281
- Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
282
- );
283
- }
284
- return result;
285
- }
286
-
287
- // ../config/src/constants.ts
288
- var STORM_DEFAULT_DOCS = "https://docs.stormsoftware.com";
289
- var STORM_DEFAULT_HOMEPAGE = "https://stormsoftware.com";
290
- var STORM_DEFAULT_LICENSING = "https://stormsoftware.com/license";
291
- var STORM_DEFAULT_LICENSE = "Apache-2.0";
292
- var STORM_DEFAULT_ERROR_CODES_FILE = "tools/errors/codes.json";
293
- var STORM_DEFAULT_BANNER_ALT = "The workspace's banner image";
294
-
295
- // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/core.js
296
- var _a;
297
- // @__NO_SIDE_EFFECTS__
298
- function $constructor(name, initializer2, params) {
299
- function init(inst, def) {
300
- if (!inst._zod) {
301
- Object.defineProperty(inst, "_zod", {
302
- value: {
303
- def,
304
- constr: _,
305
- traits: /* @__PURE__ */ new Set()
306
- },
307
- enumerable: false
308
- });
309
- }
310
- if (inst._zod.traits.has(name)) {
311
- return;
312
- }
313
- inst._zod.traits.add(name);
314
- initializer2(inst, def);
315
- const proto = _.prototype;
316
- const keys = Object.keys(proto);
317
- for (let i = 0; i < keys.length; i++) {
318
- const k = keys[i];
319
- if (!(k in inst)) {
320
- inst[k] = proto[k].bind(inst);
321
- }
322
- }
323
- }
324
- const Parent = params?.Parent ?? Object;
325
- class Definition extends Parent {
326
- }
327
- Object.defineProperty(Definition, "name", { value: name });
328
- function _(def) {
329
- var _a3;
330
- const inst = params?.Parent ? new Definition() : this;
331
- init(inst, def);
332
- (_a3 = inst._zod).deferred ?? (_a3.deferred = []);
333
- for (const fn of inst._zod.deferred) {
334
- fn();
335
- }
336
- return inst;
337
- }
338
- Object.defineProperty(_, "init", { value: init });
339
- Object.defineProperty(_, Symbol.hasInstance, {
340
- value: (inst) => {
341
- if (params?.Parent && inst instanceof params.Parent)
342
- return true;
343
- return inst?._zod?.traits?.has(name);
344
- }
345
- });
346
- Object.defineProperty(_, "name", { value: name });
347
- return _;
348
- }
349
- var $ZodAsyncError = class extends Error {
350
- constructor() {
351
- super(`Encountered Promise during synchronous parse. Use .parseAsync() instead.`);
352
- }
353
- };
354
- (_a = globalThis).__zod_globalConfig ?? (_a.__zod_globalConfig = {});
355
- var globalConfig = globalThis.__zod_globalConfig;
356
- function config(newConfig) {
357
- return globalConfig;
358
- }
359
-
360
- // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/util.js
361
- function getEnumValues(entries) {
362
- const numericValues = Object.values(entries).filter((v) => typeof v === "number");
363
- const values = Object.entries(entries).filter(([k, _]) => numericValues.indexOf(+k) === -1).map(([_, v]) => v);
364
- return values;
365
- }
366
- function jsonStringifyReplacer(_, value) {
367
- if (typeof value === "bigint")
368
- return value.toString();
369
- return value;
370
- }
371
- function cached(getter) {
372
- return {
373
- get value() {
374
- {
375
- const value = getter();
376
- Object.defineProperty(this, "value", { value });
377
- return value;
378
- }
379
- }
380
- };
381
- }
382
- function nullish(input) {
383
- return input === null || input === void 0;
384
- }
385
- function cleanRegex(source) {
386
- const start = source.startsWith("^") ? 1 : 0;
387
- const end = source.endsWith("$") ? source.length - 1 : source.length;
388
- return source.slice(start, end);
389
- }
390
- var EVALUATING = /* @__PURE__ */ Symbol("evaluating");
391
- function defineLazy(object2, key, getter) {
392
- let value = void 0;
393
- Object.defineProperty(object2, key, {
394
- get() {
395
- if (value === EVALUATING) {
396
- return void 0;
397
- }
398
- if (value === void 0) {
399
- value = EVALUATING;
400
- value = getter();
401
- }
402
- return value;
403
- },
404
- set(v) {
405
- Object.defineProperty(object2, key, {
406
- value: v
407
- // configurable: true,
408
- });
409
- },
410
- configurable: true
411
- });
412
- }
413
- var captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => {
414
- };
415
- function isObject(data) {
416
- return typeof data === "object" && data !== null && !Array.isArray(data);
417
- }
418
- function isPlainObject(o) {
419
- if (isObject(o) === false)
420
- return false;
421
- const ctor = o.constructor;
422
- if (ctor === void 0)
423
- return true;
424
- if (typeof ctor !== "function")
425
- return true;
426
- const prot = ctor.prototype;
427
- if (isObject(prot) === false)
428
- return false;
429
- if (Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf") === false) {
430
- return false;
431
- }
432
- return true;
433
- }
434
- function shallowClone(o) {
435
- if (isPlainObject(o))
436
- return { ...o };
437
- if (Array.isArray(o))
438
- return [...o];
439
- if (o instanceof Map)
440
- return new Map(o);
441
- if (o instanceof Set)
442
- return new Set(o);
443
- return o;
444
- }
445
- var propertyKeyTypes = /* @__PURE__ */ new Set(["string", "number", "symbol"]);
446
- function escapeRegex(str) {
447
- return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
448
- }
449
- function clone(inst, def, params) {
450
- const cl = new inst._zod.constr(def ?? inst._zod.def);
451
- if (!def || params?.parent)
452
- cl._zod.parent = inst;
453
- return cl;
454
- }
455
- function normalizeParams(_params) {
456
- const params = _params;
457
- if (!params)
458
- return {};
459
- if (typeof params === "string")
460
- return { error: () => params };
461
- if (params?.message !== void 0) {
462
- if (params?.error !== void 0)
463
- throw new Error("Cannot specify both `message` and `error` params");
464
- params.error = params.message;
465
- }
466
- delete params.message;
467
- if (typeof params.error === "string")
468
- return { ...params, error: () => params.error };
469
- return params;
470
- }
471
- function optionalKeys(shape) {
472
- return Object.keys(shape).filter((k) => {
473
- return shape[k]._zod.optin === "optional" && shape[k]._zod.optout === "optional";
474
- });
475
- }
476
- function aborted(x, startIndex = 0) {
477
- if (x.aborted === true)
478
- return true;
479
- for (let i = startIndex; i < x.issues.length; i++) {
480
- if (x.issues[i]?.continue !== true) {
481
- return true;
482
- }
483
- }
484
- return false;
485
- }
486
- function explicitlyAborted(x, startIndex = 0) {
487
- if (x.aborted === true)
488
- return true;
489
- for (let i = startIndex; i < x.issues.length; i++) {
490
- if (x.issues[i]?.continue === false) {
491
- return true;
492
- }
493
- }
494
- return false;
495
- }
496
- function prefixIssues(path, issues) {
497
- return issues.map((iss) => {
498
- var _a3;
499
- (_a3 = iss).path ?? (_a3.path = []);
500
- iss.path.unshift(path);
501
- return iss;
502
- });
503
- }
504
- function unwrapMessage(message) {
505
- return typeof message === "string" ? message : message?.message;
506
- }
507
- function finalizeIssue(iss, ctx, config2) {
508
- const message = iss.message ? iss.message : unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config2.customError?.(iss)) ?? unwrapMessage(config2.localeError?.(iss)) ?? "Invalid input";
509
- const { inst: _inst, continue: _continue, input: _input, ...rest } = iss;
510
- rest.path ?? (rest.path = []);
511
- rest.message = message;
512
- if (ctx?.reportInput) {
513
- rest.input = _input;
514
- }
515
- return rest;
516
- }
517
- function getLengthableOrigin(input) {
518
- if (Array.isArray(input))
519
- return "array";
520
- if (typeof input === "string")
521
- return "string";
522
- return "unknown";
523
- }
524
-
525
- // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/errors.js
526
- var initializer = (inst, def) => {
527
- inst.name = "$ZodError";
528
- Object.defineProperty(inst, "_zod", {
529
- value: inst._zod,
530
- enumerable: false
531
- });
532
- Object.defineProperty(inst, "issues", {
533
- value: def,
534
- enumerable: false
535
- });
536
- inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
537
- Object.defineProperty(inst, "toString", {
538
- value: () => inst.message,
539
- enumerable: false
540
- });
541
- };
542
- var $ZodError = $constructor("$ZodError", initializer);
543
- var $ZodRealError = $constructor("$ZodError", initializer, { Parent: Error });
544
-
545
- // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/parse.js
546
- var _parse = (_Err) => (schema, value, _ctx, _params) => {
547
- const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
548
- const result = schema._zod.run({ value, issues: [] }, ctx);
549
- if (result instanceof Promise) {
550
- throw new $ZodAsyncError();
551
- }
552
- if (result.issues.length) {
553
- const e = new (_params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
554
- captureStackTrace(e, _params?.callee);
555
- throw e;
556
- }
557
- return result.value;
558
- };
559
- var parse = /* @__PURE__ */ _parse($ZodRealError);
560
- var _parseAsync = (_Err) => async (schema, value, _ctx, params) => {
561
- const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
562
- let result = schema._zod.run({ value, issues: [] }, ctx);
563
- if (result instanceof Promise)
564
- result = await result;
565
- if (result.issues.length) {
566
- const e = new (params?.Err ?? _Err)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())));
567
- captureStackTrace(e, params?.callee);
568
- throw e;
569
- }
570
- return result.value;
571
- };
572
- var parseAsync = /* @__PURE__ */ _parseAsync($ZodRealError);
573
- var _safeParse = (_Err) => (schema, value, _ctx) => {
574
- const ctx = _ctx ? { ..._ctx, async: false } : { async: false };
575
- const result = schema._zod.run({ value, issues: [] }, ctx);
576
- if (result instanceof Promise) {
577
- throw new $ZodAsyncError();
578
- }
579
- return result.issues.length ? {
580
- success: false,
581
- error: new (_Err ?? $ZodError)(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
582
- } : { success: true, data: result.value };
583
- };
584
- var safeParse = /* @__PURE__ */ _safeParse($ZodRealError);
585
- var _safeParseAsync = (_Err) => async (schema, value, _ctx) => {
586
- const ctx = _ctx ? { ..._ctx, async: true } : { async: true };
587
- let result = schema._zod.run({ value, issues: [] }, ctx);
588
- if (result instanceof Promise)
589
- result = await result;
590
- return result.issues.length ? {
591
- success: false,
592
- error: new _Err(result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
593
- } : { success: true, data: result.value };
594
- };
595
- var safeParseAsync = /* @__PURE__ */ _safeParseAsync($ZodRealError);
596
-
597
- // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/regexes.js
598
- var httpProtocol = /^https?$/;
599
- var string = (params) => {
600
- const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : `[\\s\\S]*`;
601
- return new RegExp(`^${regex}$`);
602
- };
603
- var number = /^-?\d+(?:\.\d+)?$/;
604
- var boolean = /^(?:true|false)$/i;
605
-
606
- // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/checks.js
607
- var $ZodCheck = /* @__PURE__ */ $constructor("$ZodCheck", (inst, def) => {
608
- var _a3;
609
- inst._zod ?? (inst._zod = {});
610
- inst._zod.def = def;
611
- (_a3 = inst._zod).onattach ?? (_a3.onattach = []);
612
- });
613
- var $ZodCheckLengthEquals = /* @__PURE__ */ $constructor("$ZodCheckLengthEquals", (inst, def) => {
614
- var _a3;
615
- $ZodCheck.init(inst, def);
616
- (_a3 = inst._zod.def).when ?? (_a3.when = (payload) => {
617
- const val = payload.value;
618
- return !nullish(val) && val.length !== void 0;
619
- });
620
- inst._zod.onattach.push((inst2) => {
621
- const bag = inst2._zod.bag;
622
- bag.minimum = def.length;
623
- bag.maximum = def.length;
624
- bag.length = def.length;
625
- });
626
- inst._zod.check = (payload) => {
627
- const input = payload.value;
628
- const length = input.length;
629
- if (length === def.length)
630
- return;
631
- const origin = getLengthableOrigin(input);
632
- const tooBig = length > def.length;
633
- payload.issues.push({
634
- origin,
635
- ...tooBig ? { code: "too_big", maximum: def.length } : { code: "too_small", minimum: def.length },
636
- inclusive: true,
637
- exact: true,
638
- input: payload.value,
639
- inst,
640
- continue: !def.abort
641
- });
642
- };
643
- });
644
- var $ZodCheckStringFormat = /* @__PURE__ */ $constructor("$ZodCheckStringFormat", (inst, def) => {
645
- var _a3, _b;
646
- $ZodCheck.init(inst, def);
647
- inst._zod.onattach.push((inst2) => {
648
- const bag = inst2._zod.bag;
649
- bag.format = def.format;
650
- if (def.pattern) {
651
- bag.patterns ?? (bag.patterns = /* @__PURE__ */ new Set());
652
- bag.patterns.add(def.pattern);
653
- }
654
- });
655
- if (def.pattern)
656
- (_a3 = inst._zod).check ?? (_a3.check = (payload) => {
657
- def.pattern.lastIndex = 0;
658
- if (def.pattern.test(payload.value))
659
- return;
660
- payload.issues.push({
661
- origin: "string",
662
- code: "invalid_format",
663
- format: def.format,
664
- input: payload.value,
665
- ...def.pattern ? { pattern: def.pattern.toString() } : {},
666
- inst,
667
- continue: !def.abort
668
- });
669
- });
670
- else
671
- (_b = inst._zod).check ?? (_b.check = () => {
672
- });
673
- });
674
- var $ZodCheckRegex = /* @__PURE__ */ $constructor("$ZodCheckRegex", (inst, def) => {
675
- $ZodCheckStringFormat.init(inst, def);
676
- inst._zod.check = (payload) => {
677
- def.pattern.lastIndex = 0;
678
- if (def.pattern.test(payload.value))
679
- return;
680
- payload.issues.push({
681
- origin: "string",
682
- code: "invalid_format",
683
- format: "regex",
684
- input: payload.value,
685
- pattern: def.pattern.toString(),
686
- inst,
687
- continue: !def.abort
688
- });
689
- };
690
- });
691
- var $ZodCheckOverwrite = /* @__PURE__ */ $constructor("$ZodCheckOverwrite", (inst, def) => {
692
- $ZodCheck.init(inst, def);
693
- inst._zod.check = (payload) => {
694
- payload.value = def.tx(payload.value);
695
- };
696
- });
697
-
698
- // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/versions.js
699
- var version = {
700
- major: 4,
701
- minor: 4,
702
- patch: 3
703
- };
704
-
705
- // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/schemas.js
706
- var $ZodType = /* @__PURE__ */ $constructor("$ZodType", (inst, def) => {
707
- var _a3;
708
- inst ?? (inst = {});
709
- inst._zod.def = def;
710
- inst._zod.bag = inst._zod.bag || {};
711
- inst._zod.version = version;
712
- const checks = [...inst._zod.def.checks ?? []];
713
- if (inst._zod.traits.has("$ZodCheck")) {
714
- checks.unshift(inst);
715
- }
716
- for (const ch of checks) {
717
- for (const fn of ch._zod.onattach) {
718
- fn(inst);
719
- }
720
- }
721
- if (checks.length === 0) {
722
- (_a3 = inst._zod).deferred ?? (_a3.deferred = []);
723
- inst._zod.deferred?.push(() => {
724
- inst._zod.run = inst._zod.parse;
725
- });
726
- } else {
727
- const runChecks = (payload, checks2, ctx) => {
728
- let isAborted = aborted(payload);
729
- let asyncResult;
730
- for (const ch of checks2) {
731
- if (ch._zod.def.when) {
732
- if (explicitlyAborted(payload))
733
- continue;
734
- const shouldRun = ch._zod.def.when(payload);
735
- if (!shouldRun)
736
- continue;
737
- } else if (isAborted) {
738
- continue;
739
- }
740
- const currLen = payload.issues.length;
741
- const _ = ch._zod.check(payload);
742
- if (_ instanceof Promise && ctx?.async === false) {
743
- throw new $ZodAsyncError();
744
- }
745
- if (asyncResult || _ instanceof Promise) {
746
- asyncResult = (asyncResult ?? Promise.resolve()).then(async () => {
747
- await _;
748
- const nextLen = payload.issues.length;
749
- if (nextLen === currLen)
750
- return;
751
- if (!isAborted)
752
- isAborted = aborted(payload, currLen);
753
- });
754
- } else {
755
- const nextLen = payload.issues.length;
756
- if (nextLen === currLen)
757
- continue;
758
- if (!isAborted)
759
- isAborted = aborted(payload, currLen);
760
- }
761
- }
762
- if (asyncResult) {
763
- return asyncResult.then(() => {
764
- return payload;
765
- });
766
- }
767
- return payload;
768
- };
769
- const handleCanaryResult = (canary, payload, ctx) => {
770
- if (aborted(canary)) {
771
- canary.aborted = true;
772
- return canary;
773
- }
774
- const checkResult = runChecks(payload, checks, ctx);
775
- if (checkResult instanceof Promise) {
776
- if (ctx.async === false)
777
- throw new $ZodAsyncError();
778
- return checkResult.then((checkResult2) => inst._zod.parse(checkResult2, ctx));
779
- }
780
- return inst._zod.parse(checkResult, ctx);
781
- };
782
- inst._zod.run = (payload, ctx) => {
783
- if (ctx.skipChecks) {
784
- return inst._zod.parse(payload, ctx);
785
- }
786
- if (ctx.direction === "backward") {
787
- const canary = inst._zod.parse({ value: payload.value, issues: [] }, { ...ctx, skipChecks: true });
788
- if (canary instanceof Promise) {
789
- return canary.then((canary2) => {
790
- return handleCanaryResult(canary2, payload, ctx);
791
- });
792
- }
793
- return handleCanaryResult(canary, payload, ctx);
794
- }
795
- const result = inst._zod.parse(payload, ctx);
796
- if (result instanceof Promise) {
797
- if (ctx.async === false)
798
- throw new $ZodAsyncError();
799
- return result.then((result2) => runChecks(result2, checks, ctx));
800
- }
801
- return runChecks(result, checks, ctx);
802
- };
803
- }
804
- defineLazy(inst, "~standard", () => ({
805
- validate: (value) => {
806
- try {
807
- const r = safeParse(inst, value);
808
- return r.success ? { value: r.data } : { issues: r.error?.issues };
809
- } catch (_) {
810
- return safeParseAsync(inst, value).then((r) => r.success ? { value: r.data } : { issues: r.error?.issues });
811
- }
812
- },
813
- vendor: "zod",
814
- version: 1
815
- }));
816
- });
817
- var $ZodString = /* @__PURE__ */ $constructor("$ZodString", (inst, def) => {
818
- $ZodType.init(inst, def);
819
- inst._zod.pattern = [...inst?._zod.bag?.patterns ?? []].pop() ?? string(inst._zod.bag);
820
- inst._zod.parse = (payload, _) => {
821
- if (def.coerce)
822
- try {
823
- payload.value = String(payload.value);
824
- } catch (_2) {
825
- }
826
- if (typeof payload.value === "string")
827
- return payload;
828
- payload.issues.push({
829
- expected: "string",
830
- code: "invalid_type",
831
- input: payload.value,
832
- inst
833
- });
834
- return payload;
835
- };
836
- });
837
- var $ZodStringFormat = /* @__PURE__ */ $constructor("$ZodStringFormat", (inst, def) => {
838
- $ZodCheckStringFormat.init(inst, def);
839
- $ZodString.init(inst, def);
840
- });
841
- var $ZodURL = /* @__PURE__ */ $constructor("$ZodURL", (inst, def) => {
842
- $ZodStringFormat.init(inst, def);
843
- inst._zod.check = (payload) => {
844
- try {
845
- const trimmed = payload.value.trim();
846
- if (!def.normalize && def.protocol?.source === httpProtocol.source) {
847
- if (!/^https?:\/\//i.test(trimmed)) {
848
- payload.issues.push({
849
- code: "invalid_format",
850
- format: "url",
851
- note: "Invalid URL format",
852
- input: payload.value,
853
- inst,
854
- continue: !def.abort
855
- });
856
- return;
857
- }
858
- }
859
- const url2 = new URL(trimmed);
860
- if (def.hostname) {
861
- def.hostname.lastIndex = 0;
862
- if (!def.hostname.test(url2.hostname)) {
863
- payload.issues.push({
864
- code: "invalid_format",
865
- format: "url",
866
- note: "Invalid hostname",
867
- pattern: def.hostname.source,
868
- input: payload.value,
869
- inst,
870
- continue: !def.abort
871
- });
872
- }
873
- }
874
- if (def.protocol) {
875
- def.protocol.lastIndex = 0;
876
- if (!def.protocol.test(url2.protocol.endsWith(":") ? url2.protocol.slice(0, -1) : url2.protocol)) {
877
- payload.issues.push({
878
- code: "invalid_format",
879
- format: "url",
880
- note: "Invalid protocol",
881
- pattern: def.protocol.source,
882
- input: payload.value,
883
- inst,
884
- continue: !def.abort
885
- });
886
- }
887
- }
888
- if (def.normalize) {
889
- payload.value = url2.href;
890
- } else {
891
- payload.value = trimmed;
892
- }
893
- return;
894
- } catch (_) {
895
- payload.issues.push({
896
- code: "invalid_format",
897
- format: "url",
898
- input: payload.value,
899
- inst,
900
- continue: !def.abort
901
- });
902
- }
903
- };
904
- });
905
- var $ZodBoolean = /* @__PURE__ */ $constructor("$ZodBoolean", (inst, def) => {
906
- $ZodType.init(inst, def);
907
- inst._zod.pattern = boolean;
908
- inst._zod.parse = (payload, _ctx) => {
909
- if (def.coerce)
910
- try {
911
- payload.value = Boolean(payload.value);
912
- } catch (_) {
913
- }
914
- const input = payload.value;
915
- if (typeof input === "boolean")
916
- return payload;
917
- payload.issues.push({
918
- expected: "boolean",
919
- code: "invalid_type",
920
- input,
921
- inst
922
- });
923
- return payload;
924
- };
925
- });
926
- var $ZodAny = /* @__PURE__ */ $constructor("$ZodAny", (inst, def) => {
927
- $ZodType.init(inst, def);
928
- inst._zod.parse = (payload) => payload;
929
- });
930
- function handleArrayResult(result, final, index) {
931
- if (result.issues.length) {
932
- final.issues.push(...prefixIssues(index, result.issues));
933
- }
934
- final.value[index] = result.value;
935
- }
936
- var $ZodArray = /* @__PURE__ */ $constructor("$ZodArray", (inst, def) => {
937
- $ZodType.init(inst, def);
938
- inst._zod.parse = (payload, ctx) => {
939
- const input = payload.value;
940
- if (!Array.isArray(input)) {
941
- payload.issues.push({
942
- expected: "array",
943
- code: "invalid_type",
944
- input,
945
- inst
946
- });
947
- return payload;
948
- }
949
- payload.value = Array(input.length);
950
- const proms = [];
951
- for (let i = 0; i < input.length; i++) {
952
- const item = input[i];
953
- const result = def.element._zod.run({
954
- value: item,
955
- issues: []
956
- }, ctx);
957
- if (result instanceof Promise) {
958
- proms.push(result.then((result2) => handleArrayResult(result2, payload, i)));
959
- } else {
960
- handleArrayResult(result, payload, i);
961
- }
962
- }
963
- if (proms.length) {
964
- return Promise.all(proms).then(() => payload);
965
- }
966
- return payload;
967
- };
968
- });
969
- function handlePropertyResult(result, final, key, input, isOptionalIn, isOptionalOut) {
970
- const isPresent = key in input;
971
- if (result.issues.length) {
972
- if (isOptionalIn && isOptionalOut && !isPresent) {
973
- return;
974
- }
975
- final.issues.push(...prefixIssues(key, result.issues));
976
- }
977
- if (!isPresent && !isOptionalIn) {
978
- if (!result.issues.length) {
979
- final.issues.push({
980
- code: "invalid_type",
981
- expected: "nonoptional",
982
- input: void 0,
983
- path: [key]
984
- });
985
- }
986
- return;
987
- }
988
- if (result.value === void 0) {
989
- if (isPresent) {
990
- final.value[key] = void 0;
991
- }
992
- } else {
993
- final.value[key] = result.value;
994
- }
995
- }
996
- function normalizeDef(def) {
997
- const keys = Object.keys(def.shape);
998
- for (const k of keys) {
999
- if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) {
1000
- throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
1001
- }
1002
- }
1003
- const okeys = optionalKeys(def.shape);
1004
- return {
1005
- ...def,
1006
- keys,
1007
- keySet: new Set(keys),
1008
- numKeys: keys.length,
1009
- optionalKeys: new Set(okeys)
1010
- };
1011
- }
1012
- function handleCatchall(proms, input, payload, ctx, def, inst) {
1013
- const unrecognized = [];
1014
- const keySet = def.keySet;
1015
- const _catchall = def.catchall._zod;
1016
- const t = _catchall.def.type;
1017
- const isOptionalIn = _catchall.optin === "optional";
1018
- const isOptionalOut = _catchall.optout === "optional";
1019
- for (const key in input) {
1020
- if (key === "__proto__")
1021
- continue;
1022
- if (keySet.has(key))
1023
- continue;
1024
- if (t === "never") {
1025
- unrecognized.push(key);
1026
- continue;
1027
- }
1028
- const r = _catchall.run({ value: input[key], issues: [] }, ctx);
1029
- if (r instanceof Promise) {
1030
- proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalIn, isOptionalOut)));
1031
- } else {
1032
- handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
1033
- }
1034
- }
1035
- if (unrecognized.length) {
1036
- payload.issues.push({
1037
- code: "unrecognized_keys",
1038
- keys: unrecognized,
1039
- input,
1040
- inst
1041
- });
1042
- }
1043
- if (!proms.length)
1044
- return payload;
1045
- return Promise.all(proms).then(() => {
1046
- return payload;
1047
- });
1048
- }
1049
- var $ZodObject = /* @__PURE__ */ $constructor("$ZodObject", (inst, def) => {
1050
- $ZodType.init(inst, def);
1051
- const desc = Object.getOwnPropertyDescriptor(def, "shape");
1052
- if (!desc?.get) {
1053
- const sh = def.shape;
1054
- Object.defineProperty(def, "shape", {
1055
- get: () => {
1056
- const newSh = { ...sh };
1057
- Object.defineProperty(def, "shape", {
1058
- value: newSh
1059
- });
1060
- return newSh;
1061
- }
1062
- });
1063
- }
1064
- const _normalized = cached(() => normalizeDef(def));
1065
- defineLazy(inst._zod, "propValues", () => {
1066
- const shape = def.shape;
1067
- const propValues = {};
1068
- for (const key in shape) {
1069
- const field = shape[key]._zod;
1070
- if (field.values) {
1071
- propValues[key] ?? (propValues[key] = /* @__PURE__ */ new Set());
1072
- for (const v of field.values)
1073
- propValues[key].add(v);
1074
- }
1075
- }
1076
- return propValues;
1077
- });
1078
- const isObject2 = isObject;
1079
- const catchall = def.catchall;
1080
- let value;
1081
- inst._zod.parse = (payload, ctx) => {
1082
- value ?? (value = _normalized.value);
1083
- const input = payload.value;
1084
- if (!isObject2(input)) {
1085
- payload.issues.push({
1086
- expected: "object",
1087
- code: "invalid_type",
1088
- input,
1089
- inst
1090
- });
1091
- return payload;
1092
- }
1093
- payload.value = {};
1094
- const proms = [];
1095
- const shape = value.shape;
1096
- for (const key of value.keys) {
1097
- const el = shape[key];
1098
- const isOptionalIn = el._zod.optin === "optional";
1099
- const isOptionalOut = el._zod.optout === "optional";
1100
- const r = el._zod.run({ value: input[key], issues: [] }, ctx);
1101
- if (r instanceof Promise) {
1102
- proms.push(r.then((r2) => handlePropertyResult(r2, payload, key, input, isOptionalIn, isOptionalOut)));
1103
- } else {
1104
- handlePropertyResult(r, payload, key, input, isOptionalIn, isOptionalOut);
1105
- }
1106
- }
1107
- if (!catchall) {
1108
- return proms.length ? Promise.all(proms).then(() => payload) : payload;
1109
- }
1110
- return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
1111
- };
1112
- });
1113
- function handleUnionResults(results, final, inst, ctx) {
1114
- for (const result of results) {
1115
- if (result.issues.length === 0) {
1116
- final.value = result.value;
1117
- return final;
1118
- }
1119
- }
1120
- const nonaborted = results.filter((r) => !aborted(r));
1121
- if (nonaborted.length === 1) {
1122
- final.value = nonaborted[0].value;
1123
- return nonaborted[0];
1124
- }
1125
- final.issues.push({
1126
- code: "invalid_union",
1127
- input: final.value,
1128
- inst,
1129
- errors: results.map((result) => result.issues.map((iss) => finalizeIssue(iss, ctx, config())))
1130
- });
1131
- return final;
1132
- }
1133
- var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
1134
- $ZodType.init(inst, def);
1135
- defineLazy(inst._zod, "optin", () => def.options.some((o) => o._zod.optin === "optional") ? "optional" : void 0);
1136
- defineLazy(inst._zod, "optout", () => def.options.some((o) => o._zod.optout === "optional") ? "optional" : void 0);
1137
- defineLazy(inst._zod, "values", () => {
1138
- if (def.options.every((o) => o._zod.values)) {
1139
- return new Set(def.options.flatMap((option) => Array.from(option._zod.values)));
1140
- }
1141
- return void 0;
1142
- });
1143
- defineLazy(inst._zod, "pattern", () => {
1144
- if (def.options.every((o) => o._zod.pattern)) {
1145
- const patterns = def.options.map((o) => o._zod.pattern);
1146
- return new RegExp(`^(${patterns.map((p) => cleanRegex(p.source)).join("|")})$`);
1147
- }
1148
- return void 0;
1149
- });
1150
- const first = def.options.length === 1 ? def.options[0]._zod.run : null;
1151
- inst._zod.parse = (payload, ctx) => {
1152
- if (first) {
1153
- return first(payload, ctx);
1154
- }
1155
- let async = false;
1156
- const results = [];
1157
- for (const option of def.options) {
1158
- const result = option._zod.run({
1159
- value: payload.value,
1160
- issues: []
1161
- }, ctx);
1162
- if (result instanceof Promise) {
1163
- results.push(result);
1164
- async = true;
1165
- } else {
1166
- if (result.issues.length === 0)
1167
- return result;
1168
- results.push(result);
1169
- }
1170
- }
1171
- if (!async)
1172
- return handleUnionResults(results, payload, inst, ctx);
1173
- return Promise.all(results).then((results2) => {
1174
- return handleUnionResults(results2, payload, inst, ctx);
1175
- });
1176
- };
1177
- });
1178
- var $ZodRecord = /* @__PURE__ */ $constructor("$ZodRecord", (inst, def) => {
1179
- $ZodType.init(inst, def);
1180
- inst._zod.parse = (payload, ctx) => {
1181
- const input = payload.value;
1182
- if (!isPlainObject(input)) {
1183
- payload.issues.push({
1184
- expected: "record",
1185
- code: "invalid_type",
1186
- input,
1187
- inst
1188
- });
1189
- return payload;
1190
- }
1191
- const proms = [];
1192
- const values = def.keyType._zod.values;
1193
- if (values) {
1194
- payload.value = {};
1195
- const recordKeys = /* @__PURE__ */ new Set();
1196
- for (const key of values) {
1197
- if (typeof key === "string" || typeof key === "number" || typeof key === "symbol") {
1198
- recordKeys.add(typeof key === "number" ? key.toString() : key);
1199
- const keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
1200
- if (keyResult instanceof Promise) {
1201
- throw new Error("Async schemas not supported in object keys currently");
1202
- }
1203
- if (keyResult.issues.length) {
1204
- payload.issues.push({
1205
- code: "invalid_key",
1206
- origin: "record",
1207
- issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
1208
- input: key,
1209
- path: [key],
1210
- inst
1211
- });
1212
- continue;
1213
- }
1214
- const outKey = keyResult.value;
1215
- const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
1216
- if (result instanceof Promise) {
1217
- proms.push(result.then((result2) => {
1218
- if (result2.issues.length) {
1219
- payload.issues.push(...prefixIssues(key, result2.issues));
1220
- }
1221
- payload.value[outKey] = result2.value;
1222
- }));
1223
- } else {
1224
- if (result.issues.length) {
1225
- payload.issues.push(...prefixIssues(key, result.issues));
1226
- }
1227
- payload.value[outKey] = result.value;
1228
- }
1229
- }
1230
- }
1231
- let unrecognized;
1232
- for (const key in input) {
1233
- if (!recordKeys.has(key)) {
1234
- unrecognized = unrecognized ?? [];
1235
- unrecognized.push(key);
1236
- }
1237
- }
1238
- if (unrecognized && unrecognized.length > 0) {
1239
- payload.issues.push({
1240
- code: "unrecognized_keys",
1241
- input,
1242
- inst,
1243
- keys: unrecognized
1244
- });
1245
- }
1246
- } else {
1247
- payload.value = {};
1248
- for (const key of Reflect.ownKeys(input)) {
1249
- if (key === "__proto__")
1250
- continue;
1251
- if (!Object.prototype.propertyIsEnumerable.call(input, key))
1252
- continue;
1253
- let keyResult = def.keyType._zod.run({ value: key, issues: [] }, ctx);
1254
- if (keyResult instanceof Promise) {
1255
- throw new Error("Async schemas not supported in object keys currently");
1256
- }
1257
- const checkNumericKey = typeof key === "string" && number.test(key) && keyResult.issues.length;
1258
- if (checkNumericKey) {
1259
- const retryResult = def.keyType._zod.run({ value: Number(key), issues: [] }, ctx);
1260
- if (retryResult instanceof Promise) {
1261
- throw new Error("Async schemas not supported in object keys currently");
1262
- }
1263
- if (retryResult.issues.length === 0) {
1264
- keyResult = retryResult;
1265
- }
1266
- }
1267
- if (keyResult.issues.length) {
1268
- if (def.mode === "loose") {
1269
- payload.value[key] = input[key];
1270
- } else {
1271
- payload.issues.push({
1272
- code: "invalid_key",
1273
- origin: "record",
1274
- issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
1275
- input: key,
1276
- path: [key],
1277
- inst
1278
- });
1279
- }
1280
- continue;
1281
- }
1282
- const result = def.valueType._zod.run({ value: input[key], issues: [] }, ctx);
1283
- if (result instanceof Promise) {
1284
- proms.push(result.then((result2) => {
1285
- if (result2.issues.length) {
1286
- payload.issues.push(...prefixIssues(key, result2.issues));
1287
- }
1288
- payload.value[keyResult.value] = result2.value;
1289
- }));
1290
- } else {
1291
- if (result.issues.length) {
1292
- payload.issues.push(...prefixIssues(key, result.issues));
1293
- }
1294
- payload.value[keyResult.value] = result.value;
1295
- }
1296
- }
1297
- }
1298
- if (proms.length) {
1299
- return Promise.all(proms).then(() => payload);
1300
- }
1301
- return payload;
1302
- };
1303
- });
1304
- var $ZodEnum = /* @__PURE__ */ $constructor("$ZodEnum", (inst, def) => {
1305
- $ZodType.init(inst, def);
1306
- const values = getEnumValues(def.entries);
1307
- const valuesSet = new Set(values);
1308
- inst._zod.values = valuesSet;
1309
- inst._zod.pattern = new RegExp(`^(${values.filter((k) => propertyKeyTypes.has(typeof k)).map((o) => typeof o === "string" ? escapeRegex(o) : o.toString()).join("|")})$`);
1310
- inst._zod.parse = (payload, _ctx) => {
1311
- const input = payload.value;
1312
- if (valuesSet.has(input)) {
1313
- return payload;
1314
- }
1315
- payload.issues.push({
1316
- code: "invalid_value",
1317
- values,
1318
- input,
1319
- inst
1320
- });
1321
- return payload;
1322
- };
1323
- });
1324
- var $ZodLiteral = /* @__PURE__ */ $constructor("$ZodLiteral", (inst, def) => {
1325
- $ZodType.init(inst, def);
1326
- if (def.values.length === 0) {
1327
- throw new Error("Cannot create literal schema with no valid values");
1328
- }
1329
- const values = new Set(def.values);
1330
- inst._zod.values = values;
1331
- inst._zod.pattern = new RegExp(`^(${def.values.map((o) => typeof o === "string" ? escapeRegex(o) : o ? escapeRegex(o.toString()) : String(o)).join("|")})$`);
1332
- inst._zod.parse = (payload, _ctx) => {
1333
- const input = payload.value;
1334
- if (values.has(input)) {
1335
- return payload;
1336
- }
1337
- payload.issues.push({
1338
- code: "invalid_value",
1339
- values: def.values,
1340
- input,
1341
- inst
1342
- });
1343
- return payload;
1344
- };
1345
- });
1346
- function handleOptionalResult(result, input) {
1347
- if (input === void 0 && (result.issues.length || result.fallback)) {
1348
- return { issues: [], value: void 0 };
1349
- }
1350
- return result;
1351
- }
1352
- var $ZodOptional = /* @__PURE__ */ $constructor("$ZodOptional", (inst, def) => {
1353
- $ZodType.init(inst, def);
1354
- inst._zod.optin = "optional";
1355
- inst._zod.optout = "optional";
1356
- defineLazy(inst._zod, "values", () => {
1357
- return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, void 0]) : void 0;
1358
- });
1359
- defineLazy(inst._zod, "pattern", () => {
1360
- const pattern = def.innerType._zod.pattern;
1361
- return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
1362
- });
1363
- inst._zod.parse = (payload, ctx) => {
1364
- if (def.innerType._zod.optin === "optional") {
1365
- const input = payload.value;
1366
- const result = def.innerType._zod.run(payload, ctx);
1367
- if (result instanceof Promise)
1368
- return result.then((r) => handleOptionalResult(r, input));
1369
- return handleOptionalResult(result, input);
1370
- }
1371
- if (payload.value === void 0) {
1372
- return payload;
1373
- }
1374
- return def.innerType._zod.run(payload, ctx);
1375
- };
1376
- });
1377
- var $ZodNullable = /* @__PURE__ */ $constructor("$ZodNullable", (inst, def) => {
1378
- $ZodType.init(inst, def);
1379
- defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
1380
- defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
1381
- defineLazy(inst._zod, "pattern", () => {
1382
- const pattern = def.innerType._zod.pattern;
1383
- return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
1384
- });
1385
- defineLazy(inst._zod, "values", () => {
1386
- return def.innerType._zod.values ? /* @__PURE__ */ new Set([...def.innerType._zod.values, null]) : void 0;
1387
- });
1388
- inst._zod.parse = (payload, ctx) => {
1389
- if (payload.value === null)
1390
- return payload;
1391
- return def.innerType._zod.run(payload, ctx);
1392
- };
1393
- });
1394
- var $ZodDefault = /* @__PURE__ */ $constructor("$ZodDefault", (inst, def) => {
1395
- $ZodType.init(inst, def);
1396
- inst._zod.optin = "optional";
1397
- defineLazy(inst._zod, "values", () => def.innerType._zod.values);
1398
- inst._zod.parse = (payload, ctx) => {
1399
- if (ctx.direction === "backward") {
1400
- return def.innerType._zod.run(payload, ctx);
1401
- }
1402
- if (payload.value === void 0) {
1403
- payload.value = def.defaultValue;
1404
- return payload;
1405
- }
1406
- const result = def.innerType._zod.run(payload, ctx);
1407
- if (result instanceof Promise) {
1408
- return result.then((result2) => handleDefaultResult(result2, def));
1409
- }
1410
- return handleDefaultResult(result, def);
1411
- };
1412
- });
1413
- function handleDefaultResult(payload, def) {
1414
- if (payload.value === void 0) {
1415
- payload.value = def.defaultValue;
1416
- }
1417
- return payload;
1418
- }
1419
-
1420
- // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/registries.js
1421
- var _a2;
1422
- var $ZodRegistry = class {
1423
- constructor() {
1424
- this._map = /* @__PURE__ */ new WeakMap();
1425
- this._idmap = /* @__PURE__ */ new Map();
1426
- }
1427
- add(schema, ..._meta) {
1428
- const meta2 = _meta[0];
1429
- this._map.set(schema, meta2);
1430
- if (meta2 && typeof meta2 === "object" && "id" in meta2) {
1431
- this._idmap.set(meta2.id, schema);
1432
- }
1433
- return this;
1434
- }
1435
- clear() {
1436
- this._map = /* @__PURE__ */ new WeakMap();
1437
- this._idmap = /* @__PURE__ */ new Map();
1438
- return this;
1439
- }
1440
- remove(schema) {
1441
- const meta2 = this._map.get(schema);
1442
- if (meta2 && typeof meta2 === "object" && "id" in meta2) {
1443
- this._idmap.delete(meta2.id);
1444
- }
1445
- this._map.delete(schema);
1446
- return this;
1447
- }
1448
- get(schema) {
1449
- const p = schema._zod.parent;
1450
- if (p) {
1451
- const pm = { ...this.get(p) ?? {} };
1452
- delete pm.id;
1453
- const f = { ...pm, ...this._map.get(schema) };
1454
- return Object.keys(f).length ? f : void 0;
1455
- }
1456
- return this._map.get(schema);
1457
- }
1458
- has(schema) {
1459
- return this._map.has(schema);
1460
- }
1461
- };
1462
- function registry() {
1463
- return new $ZodRegistry();
1464
- }
1465
- (_a2 = globalThis).__zod_globalRegistry ?? (_a2.__zod_globalRegistry = registry());
1466
-
1467
- // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/core/api.js
1468
- // @__NO_SIDE_EFFECTS__
1469
- function _string(Class, params) {
1470
- return new Class({
1471
- type: "string",
1472
- ...normalizeParams(params)
1473
- });
1474
- }
1475
- // @__NO_SIDE_EFFECTS__
1476
- function _url(Class, params) {
1477
- return new Class({
1478
- type: "string",
1479
- format: "url",
1480
- check: "string_format",
1481
- abort: false,
1482
- ...normalizeParams(params)
1483
- });
1484
- }
1485
- // @__NO_SIDE_EFFECTS__
1486
- function _boolean(Class, params) {
1487
- return new Class({
1488
- type: "boolean",
1489
- ...normalizeParams(params)
1490
- });
1491
- }
1492
- // @__NO_SIDE_EFFECTS__
1493
- function _any(Class) {
1494
- return new Class({
1495
- type: "any"
1496
- });
1497
- }
1498
- // @__NO_SIDE_EFFECTS__
1499
- function _length(length, params) {
1500
- return new $ZodCheckLengthEquals({
1501
- check: "length_equals",
1502
- ...normalizeParams(params),
1503
- length
1504
- });
1505
- }
1506
- // @__NO_SIDE_EFFECTS__
1507
- function _regex(pattern, params) {
1508
- return new $ZodCheckRegex({
1509
- check: "string_format",
1510
- format: "regex",
1511
- ...normalizeParams(params),
1512
- pattern
1513
- });
1514
- }
1515
- // @__NO_SIDE_EFFECTS__
1516
- function _overwrite(tx) {
1517
- return new $ZodCheckOverwrite({
1518
- check: "overwrite",
1519
- tx
1520
- });
1521
- }
1522
- // @__NO_SIDE_EFFECTS__
1523
- function _trim() {
1524
- return /* @__PURE__ */ _overwrite((input) => input.trim());
1525
- }
1526
- // @__NO_SIDE_EFFECTS__
1527
- function _toLowerCase() {
1528
- return /* @__PURE__ */ _overwrite((input) => input.toLowerCase());
1529
- }
1530
-
1531
- // ../../node_modules/.pnpm/zod@4.4.3/node_modules/zod/v4/mini/schemas.js
1532
- var ZodMiniType = /* @__PURE__ */ $constructor("ZodMiniType", (inst, def) => {
1533
- if (!inst._zod)
1534
- throw new Error("Uninitialized schema in ZodMiniType.");
1535
- $ZodType.init(inst, def);
1536
- inst.def = def;
1537
- inst.type = def.type;
1538
- inst.parse = (data, params) => parse(inst, data, params, { callee: inst.parse });
1539
- inst.safeParse = (data, params) => safeParse(inst, data, params);
1540
- inst.parseAsync = async (data, params) => parseAsync(inst, data, params, { callee: inst.parseAsync });
1541
- inst.safeParseAsync = async (data, params) => safeParseAsync(inst, data, params);
1542
- inst.check = (...checks) => {
1543
- return inst.clone({
1544
- ...def,
1545
- checks: [
1546
- ...def.checks ?? [],
1547
- ...checks.map((ch) => typeof ch === "function" ? {
1548
- _zod: { check: ch, def: { check: "custom" }, onattach: [] }
1549
- } : ch)
1550
- ]
1551
- }, { parent: true });
1552
- };
1553
- inst.with = inst.check;
1554
- inst.clone = (_def, params) => clone(inst, _def, params);
1555
- inst.brand = () => inst;
1556
- inst.register = ((reg, meta2) => {
1557
- reg.add(inst, meta2);
1558
- return inst;
1559
- });
1560
- inst.apply = (fn) => fn(inst);
1561
- });
1562
- var ZodMiniString = /* @__PURE__ */ $constructor("ZodMiniString", (inst, def) => {
1563
- $ZodString.init(inst, def);
1564
- ZodMiniType.init(inst, def);
1565
- });
1566
- // @__NO_SIDE_EFFECTS__
1567
- function string2(params) {
1568
- return _string(ZodMiniString, params);
1569
- }
1570
- var ZodMiniStringFormat = /* @__PURE__ */ $constructor("ZodMiniStringFormat", (inst, def) => {
1571
- $ZodStringFormat.init(inst, def);
1572
- ZodMiniString.init(inst, def);
1573
- });
1574
- var ZodMiniURL = /* @__PURE__ */ $constructor("ZodMiniURL", (inst, def) => {
1575
- $ZodURL.init(inst, def);
1576
- ZodMiniStringFormat.init(inst, def);
1577
- });
1578
- // @__NO_SIDE_EFFECTS__
1579
- function url(params) {
1580
- return _url(ZodMiniURL, params);
1581
- }
1582
- var ZodMiniBoolean = /* @__PURE__ */ $constructor("ZodMiniBoolean", (inst, def) => {
1583
- $ZodBoolean.init(inst, def);
1584
- ZodMiniType.init(inst, def);
1585
- });
1586
- // @__NO_SIDE_EFFECTS__
1587
- function boolean2(params) {
1588
- return _boolean(ZodMiniBoolean, params);
1589
- }
1590
- var ZodMiniAny = /* @__PURE__ */ $constructor("ZodMiniAny", (inst, def) => {
1591
- $ZodAny.init(inst, def);
1592
- ZodMiniType.init(inst, def);
1593
- });
1594
- // @__NO_SIDE_EFFECTS__
1595
- function any() {
1596
- return _any(ZodMiniAny);
1597
- }
1598
- var ZodMiniArray = /* @__PURE__ */ $constructor("ZodMiniArray", (inst, def) => {
1599
- $ZodArray.init(inst, def);
1600
- ZodMiniType.init(inst, def);
1601
- });
1602
- // @__NO_SIDE_EFFECTS__
1603
- function array(element, params) {
1604
- return new ZodMiniArray({
1605
- type: "array",
1606
- element,
1607
- ...normalizeParams(params)
1608
- });
1609
- }
1610
- var ZodMiniObject = /* @__PURE__ */ $constructor("ZodMiniObject", (inst, def) => {
1611
- $ZodObject.init(inst, def);
1612
- ZodMiniType.init(inst, def);
1613
- defineLazy(inst, "shape", () => def.shape);
1614
- });
1615
- // @__NO_SIDE_EFFECTS__
1616
- function object(shape, params) {
1617
- const def = {
1618
- type: "object",
1619
- shape: shape ?? {},
1620
- ...normalizeParams(params)
1621
- };
1622
- return new ZodMiniObject(def);
1623
- }
1624
- var ZodMiniUnion = /* @__PURE__ */ $constructor("ZodMiniUnion", (inst, def) => {
1625
- $ZodUnion.init(inst, def);
1626
- ZodMiniType.init(inst, def);
1627
- });
1628
- // @__NO_SIDE_EFFECTS__
1629
- function union(options, params) {
1630
- return new ZodMiniUnion({
1631
- type: "union",
1632
- options,
1633
- ...normalizeParams(params)
1634
- });
1635
- }
1636
- var ZodMiniRecord = /* @__PURE__ */ $constructor("ZodMiniRecord", (inst, def) => {
1637
- $ZodRecord.init(inst, def);
1638
- ZodMiniType.init(inst, def);
1639
- });
1640
- // @__NO_SIDE_EFFECTS__
1641
- function record(keyType, valueType, params) {
1642
- if (!valueType || !valueType._zod) {
1643
- return new ZodMiniRecord({
1644
- type: "record",
1645
- keyType: /* @__PURE__ */ string2(),
1646
- valueType: keyType,
1647
- ...normalizeParams(valueType)
1648
- });
1649
- }
1650
- return new ZodMiniRecord({
1651
- type: "record",
1652
- keyType,
1653
- valueType,
1654
- ...normalizeParams(params)
1655
- });
1656
- }
1657
- var ZodMiniEnum = /* @__PURE__ */ $constructor("ZodMiniEnum", (inst, def) => {
1658
- $ZodEnum.init(inst, def);
1659
- ZodMiniType.init(inst, def);
1660
- inst.options = Object.values(def.entries);
1661
- });
1662
- // @__NO_SIDE_EFFECTS__
1663
- function _enum(values, params) {
1664
- const entries = Array.isArray(values) ? Object.fromEntries(values.map((v) => [v, v])) : values;
1665
- return new ZodMiniEnum({
1666
- type: "enum",
1667
- entries,
1668
- ...normalizeParams(params)
1669
- });
1670
- }
1671
- var ZodMiniLiteral = /* @__PURE__ */ $constructor("ZodMiniLiteral", (inst, def) => {
1672
- $ZodLiteral.init(inst, def);
1673
- ZodMiniType.init(inst, def);
1674
- });
1675
- // @__NO_SIDE_EFFECTS__
1676
- function literal(value, params) {
1677
- return new ZodMiniLiteral({
1678
- type: "literal",
1679
- values: Array.isArray(value) ? value : [value],
1680
- ...normalizeParams(params)
1681
- });
1682
- }
1683
- var ZodMiniOptional = /* @__PURE__ */ $constructor("ZodMiniOptional", (inst, def) => {
1684
- $ZodOptional.init(inst, def);
1685
- ZodMiniType.init(inst, def);
1686
- });
1687
- // @__NO_SIDE_EFFECTS__
1688
- function optional(innerType) {
1689
- return new ZodMiniOptional({
1690
- type: "optional",
1691
- innerType
1692
- });
1693
- }
1694
- var ZodMiniNullable = /* @__PURE__ */ $constructor("ZodMiniNullable", (inst, def) => {
1695
- $ZodNullable.init(inst, def);
1696
- ZodMiniType.init(inst, def);
1697
- });
1698
- // @__NO_SIDE_EFFECTS__
1699
- function nullable(innerType) {
1700
- return new ZodMiniNullable({
1701
- type: "nullable",
1702
- innerType
1703
- });
1704
- }
1705
- var ZodMiniDefault = /* @__PURE__ */ $constructor("ZodMiniDefault", (inst, def) => {
1706
- $ZodDefault.init(inst, def);
1707
- ZodMiniType.init(inst, def);
1708
- });
1709
- // @__NO_SIDE_EFFECTS__
1710
- function _default(innerType, defaultValue) {
1711
- return new ZodMiniDefault({
1712
- type: "default",
1713
- innerType,
1714
- get defaultValue() {
1715
- return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
1716
- }
1717
- });
1718
- }
1719
-
1720
- // ../config/src/schema.ts
1721
- var schemaRegistry = registry();
1722
- var colorSchema = string2().check(
1723
- _length(7),
1724
- _toLowerCase(),
1725
- _regex(/^#([0-9a-f]{3}){1,2}$/i),
1726
- _trim()
1727
- );
1728
- schemaRegistry.add(colorSchema, {
1729
- description: "A base schema for describing the format of colors"
1730
- });
1731
- var darkColorSchema = _default(colorSchema, "#1e2124");
1732
- schemaRegistry.add(darkColorSchema, {
1733
- description: "The dark background color of the workspace"
1734
- });
1735
- var lightColorSchema = _default(colorSchema, "#cbd5e1");
1736
- schemaRegistry.add(lightColorSchema, {
1737
- description: "The light background color of the workspace"
1738
- });
1739
- var brandColorSchema = _default(colorSchema, "#1fb2a6");
1740
- schemaRegistry.add(brandColorSchema, {
1741
- description: "The primary brand specific color of the workspace"
1742
- });
1743
- var alternateColorSchema = optional(colorSchema);
1744
- schemaRegistry.add(alternateColorSchema, {
1745
- description: "The alternate brand specific color of the workspace"
1746
- });
1747
- var accentColorSchema = optional(colorSchema);
1748
- schemaRegistry.add(accentColorSchema, {
1749
- description: "The secondary brand specific color of the workspace"
1750
- });
1751
- var linkColorSchema = _default(colorSchema, "#3fa6ff");
1752
- schemaRegistry.add(linkColorSchema, {
1753
- description: "The color used to display hyperlink text"
1754
- });
1755
- var discoveryColorSchema = _default(colorSchema, "#818cf8");
1756
- schemaRegistry.add(discoveryColorSchema, {
1757
- description: "The second brand specific color of the workspace"
1758
- });
1759
- var successColorSchema = _default(colorSchema, "#45b27e");
1760
- schemaRegistry.add(successColorSchema, {
1761
- description: "The success color of the workspace"
1762
- });
1763
- var infoColorSchema = _default(colorSchema, "#38bdf8");
1764
- schemaRegistry.add(infoColorSchema, {
1765
- description: "The informational color of the workspace"
1766
- });
1767
- var debugColorSchema = _default(colorSchema, "#8afafc");
1768
- schemaRegistry.add(debugColorSchema, {
1769
- description: "The debug color of the workspace"
1770
- });
1771
- var warningColorSchema = _default(colorSchema, "#f3d371");
1772
- schemaRegistry.add(warningColorSchema, {
1773
- description: "The warning color of the workspace"
1774
- });
1775
- var dangerColorSchema = _default(colorSchema, "#d8314a");
1776
- schemaRegistry.add(dangerColorSchema, {
1777
- description: "The danger color of the workspace"
1778
- });
1779
- var fatalColorSchema = optional(colorSchema);
1780
- schemaRegistry.add(fatalColorSchema, {
1781
- description: "The fatal color of the workspace"
1782
- });
1783
- var performanceColorSchema = _default(colorSchema, "#80fd74");
1784
- schemaRegistry.add(performanceColorSchema, {
1785
- description: "The performance color of the workspace"
1786
- });
1787
- var positiveColorSchema = _default(colorSchema, "#4ade80");
1788
- schemaRegistry.add(positiveColorSchema, {
1789
- description: "The positive number color of the workspace"
1790
- });
1791
- var negativeColorSchema = _default(colorSchema, "#ef4444");
1792
- schemaRegistry.add(negativeColorSchema, {
1793
- description: "The negative number color of the workspace"
1794
- });
1795
- var gradientStopsSchema = optional(array(colorSchema));
1796
- schemaRegistry.add(gradientStopsSchema, {
1797
- description: "The color stops for the base gradient color pattern used in the workspace"
1798
- });
1799
- var darkColorsSchema = object({
1800
- foreground: lightColorSchema,
1801
- background: darkColorSchema,
1802
- brand: brandColorSchema,
1803
- alternate: alternateColorSchema,
1804
- accent: accentColorSchema,
1805
- link: linkColorSchema,
1806
- discovery: discoveryColorSchema,
1807
- success: successColorSchema,
1808
- info: infoColorSchema,
1809
- debug: debugColorSchema,
1810
- warning: warningColorSchema,
1811
- danger: dangerColorSchema,
1812
- fatal: fatalColorSchema,
1813
- performance: performanceColorSchema,
1814
- positive: positiveColorSchema,
1815
- negative: negativeColorSchema,
1816
- gradient: gradientStopsSchema
1817
- });
1818
- var lightColorsSchema = object({
1819
- foreground: darkColorSchema,
1820
- background: lightColorSchema,
1821
- brand: brandColorSchema,
1822
- alternate: alternateColorSchema,
1823
- accent: accentColorSchema,
1824
- link: linkColorSchema,
1825
- discovery: discoveryColorSchema,
1826
- success: successColorSchema,
1827
- info: infoColorSchema,
1828
- debug: debugColorSchema,
1829
- warning: warningColorSchema,
1830
- danger: dangerColorSchema,
1831
- fatal: fatalColorSchema,
1832
- performance: performanceColorSchema,
1833
- positive: positiveColorSchema,
1834
- negative: negativeColorSchema,
1835
- gradient: gradientStopsSchema
1836
- });
1837
- var multiColorsSchema = object({
1838
- dark: darkColorsSchema,
1839
- light: lightColorsSchema
1840
- });
1841
- var singleColorsSchema = object({
1842
- dark: darkColorSchema,
1843
- light: lightColorSchema,
1844
- brand: brandColorSchema,
1845
- alternate: alternateColorSchema,
1846
- accent: accentColorSchema,
1847
- link: linkColorSchema,
1848
- discovery: discoveryColorSchema,
1849
- success: successColorSchema,
1850
- info: infoColorSchema,
1851
- debug: debugColorSchema,
1852
- warning: warningColorSchema,
1853
- danger: dangerColorSchema,
1854
- fatal: fatalColorSchema,
1855
- performance: performanceColorSchema,
1856
- positive: positiveColorSchema,
1857
- negative: negativeColorSchema,
1858
- gradient: gradientStopsSchema
1859
- });
1860
- var registryUrlConfigSchema = optional(url());
1861
- schemaRegistry.add(registryUrlConfigSchema, {
1862
- description: "A remote registry URL used to publish distributable packages"
1863
- });
1864
- var registrySchema = _default(
1865
- object({
1866
- github: registryUrlConfigSchema,
1867
- npm: registryUrlConfigSchema,
1868
- cargo: registryUrlConfigSchema,
1869
- cyclone: registryUrlConfigSchema,
1870
- container: registryUrlConfigSchema
1871
- }),
1872
- {}
1873
- );
1874
- schemaRegistry.add(registrySchema, {
1875
- description: "A list of remote registry URLs used by Storm Software"
1876
- });
1877
- var colorsSchema = union([singleColorsSchema, multiColorsSchema]);
1878
- schemaRegistry.add(colorsSchema, {
1879
- description: "Colors used for various workspace elements"
1880
- });
1881
- var themeColorsSchema = record(
1882
- union([union([literal("base"), string2()]), string2()]),
1883
- colorsSchema
1884
- );
1885
- schemaRegistry.add(themeColorsSchema, {
1886
- description: "Storm theme config values used for styling various package elements"
1887
- });
1888
- var extendsSchema = optional(
1889
- union([string2().check(_trim()), array(string2().check(_trim()))])
1890
- );
1891
- schemaRegistry.add(extendsSchema, {
1892
- description: "The path to a base config file to use as a configuration preset file. Documentation can be found at https://github.com/unjs/c12#extending-configuration."
1893
- });
1894
- var workspaceBotNameSchema = string2().check(_trim());
1895
- schemaRegistry.add(workspaceBotNameSchema, {
1896
- description: "The workspace bot user's name (this is the bot that will be used to perform various tasks)"
1897
- });
1898
- var workspaceBotEmailSchema = string2().check(_trim());
1899
- schemaRegistry.add(workspaceBotEmailSchema, {
1900
- description: "The email of the workspace bot"
1901
- });
1902
- var workspaceBotSchema = object({
1903
- name: workspaceBotNameSchema,
1904
- email: workspaceBotEmailSchema
1905
- });
1906
- schemaRegistry.add(workspaceBotSchema, {
1907
- description: "The workspace's bot user's config used to automated various operations tasks"
1908
- });
1909
- var workspaceReleaseBannerUrlSchema = optional(
1910
- string2().check(_trim(), url())
1911
- );
1912
- schemaRegistry.add(workspaceReleaseBannerUrlSchema, {
1913
- description: "A URL to a banner image used to display the workspace's release"
1914
- });
1915
- var workspaceReleaseBannerAltSchema = _default(
1916
- string2().check(_trim()),
1917
- STORM_DEFAULT_BANNER_ALT
1918
- );
1919
- schemaRegistry.add(workspaceReleaseBannerAltSchema, {
1920
- description: "The alt text for the workspace's release banner image"
1921
- });
1922
- var workspaceReleaseBannerSchema = object({
1923
- url: workspaceReleaseBannerUrlSchema,
1924
- alt: workspaceReleaseBannerAltSchema
1925
- });
1926
- schemaRegistry.add(workspaceReleaseBannerSchema, {
1927
- description: "The workspace's banner image used during the release process"
1928
- });
1929
- var workspaceReleaseHeaderSchema = optional(
1930
- string2().check(_trim())
1931
- );
1932
- schemaRegistry.add(workspaceReleaseHeaderSchema, {
1933
- description: "A header message appended to the start of the workspace's release notes"
1934
- });
1935
- var workspaceReleaseFooterSchema = optional(
1936
- string2().check(_trim())
1937
- );
1938
- schemaRegistry.add(workspaceReleaseFooterSchema, {
1939
- description: "A footer message appended to the end of the workspace's release notes"
1940
- });
1941
- var workspaceReleaseSchema = object({
1942
- banner: union([
1943
- workspaceReleaseBannerSchema,
1944
- string2().check(_trim(), url())
1945
- ]),
1946
- header: workspaceReleaseHeaderSchema,
1947
- footer: workspaceReleaseFooterSchema
1948
- });
1949
- schemaRegistry.add(workspaceReleaseSchema, {
1950
- description: "The workspace's release config used during the release process"
1951
- });
1952
- var workspaceSocialsTwitterSchema = optional(
1953
- string2().check(_trim())
1954
- );
1955
- schemaRegistry.add(workspaceSocialsTwitterSchema, {
1956
- description: "A Twitter/X account associated with the organization/project"
1957
- });
1958
- var workspaceSocialsDiscordSchema = optional(
1959
- string2().check(_trim())
1960
- );
1961
- schemaRegistry.add(workspaceSocialsDiscordSchema, {
1962
- description: "A Discord account associated with the organization/project"
1963
- });
1964
- var workspaceSocialsTelegramSchema = optional(
1965
- string2().check(_trim())
1966
- );
1967
- schemaRegistry.add(workspaceSocialsTelegramSchema, {
1968
- description: "A Telegram account associated with the organization/project"
1969
- });
1970
- var workspaceSocialsSlackSchema = optional(
1971
- string2().check(_trim())
1972
- );
1973
- schemaRegistry.add(workspaceSocialsSlackSchema, {
1974
- description: "A Slack account associated with the organization/project"
1975
- });
1976
- var workspaceSocialsMediumSchema = optional(
1977
- string2().check(_trim())
1978
- );
1979
- schemaRegistry.add(workspaceSocialsMediumSchema, {
1980
- description: "A Medium account associated with the organization/project"
1981
- });
1982
- var workspaceSocialsGithubSchema = optional(
1983
- string2().check(_trim())
1984
- );
1985
- schemaRegistry.add(workspaceSocialsGithubSchema, {
1986
- description: "A GitHub account associated with the organization/project"
1987
- });
1988
- var workspaceSocialsSchema = object({
1989
- twitter: workspaceSocialsTwitterSchema,
1990
- discord: workspaceSocialsDiscordSchema,
1991
- telegram: workspaceSocialsTelegramSchema,
1992
- slack: workspaceSocialsSlackSchema,
1993
- medium: workspaceSocialsMediumSchema,
1994
- github: workspaceSocialsGithubSchema
1995
- });
1996
- schemaRegistry.add(workspaceSocialsSchema, {
1997
- description: "The workspace's account config used to store various social media links"
1998
- });
1999
- var workspaceDirectoryCacheSchema = optional(
2000
- string2().check(_trim())
2001
- );
2002
- schemaRegistry.add(workspaceDirectoryCacheSchema, {
2003
- description: "The directory used to store the environment's cached file data"
2004
- });
2005
- var workspaceDirectoryDataSchema = optional(
2006
- string2().check(_trim())
2007
- );
2008
- schemaRegistry.add(workspaceDirectoryDataSchema, {
2009
- description: "The directory used to store the environment's data files"
2010
- });
2011
- var workspaceDirectoryConfigSchema = optional(
2012
- string2().check(_trim())
2013
- );
2014
- schemaRegistry.add(workspaceDirectoryConfigSchema, {
2015
- description: "The directory used to store the environment's configuration files"
2016
- });
2017
- var workspaceDirectoryTempSchema = optional(
2018
- string2().check(_trim())
2019
- );
2020
- schemaRegistry.add(workspaceDirectoryTempSchema, {
2021
- description: "The directory used to store the environment's temp files"
2022
- });
2023
- var workspaceDirectoryLogSchema = optional(
2024
- string2().check(_trim())
2025
- );
2026
- schemaRegistry.add(workspaceDirectoryLogSchema, {
2027
- description: "The directory used to store the environment's log files"
2028
- });
2029
- var workspaceDirectoryBuildSchema = _default(
2030
- string2().check(_trim()),
2031
- "dist"
2032
- );
2033
- schemaRegistry.add(workspaceDirectoryBuildSchema, {
2034
- description: "The directory used to store the workspace's distributable files after a build (relative to the workspace root)"
2035
- });
2036
- var workspaceDirectorySchema = object({
2037
- cache: workspaceDirectoryCacheSchema,
2038
- data: workspaceDirectoryDataSchema,
2039
- config: workspaceDirectoryConfigSchema,
2040
- temp: workspaceDirectoryTempSchema,
2041
- log: workspaceDirectoryLogSchema,
2042
- build: workspaceDirectoryBuildSchema
2043
- });
2044
- schemaRegistry.add(workspaceDirectorySchema, {
2045
- description: "Various directories used by the workspace to store data, cache, and configuration files"
2046
- });
2047
- var variantSchema = _default(
2048
- _enum(["minimal", "monorepo"]),
2049
- "monorepo"
2050
- );
2051
- schemaRegistry.add(variantSchema, {
2052
- description: "The variant of the workspace. This can be used to enable or disable certain features or configurations."
2053
- });
2054
- var errorCodesFileSchema = _default(
2055
- string2().check(_trim()),
2056
- STORM_DEFAULT_ERROR_CODES_FILE
2057
- );
2058
- schemaRegistry.add(errorCodesFileSchema, {
2059
- description: "The path to the workspace's error codes JSON file"
2060
- });
2061
- var errorUrlSchema = optional(url());
2062
- schemaRegistry.add(errorUrlSchema, {
2063
- description: "A URL to a page that looks up the workspace's error messages given a specific error code"
2064
- });
2065
- var errorSchema = object({
2066
- codesFile: errorCodesFileSchema,
2067
- url: errorUrlSchema
2068
- });
2069
- schemaRegistry.add(errorSchema, {
2070
- description: "The workspace's error config used when creating error details during a system error"
2071
- });
2072
- var organizationNameSchema = optional(
2073
- string2().check(_trim(), _toLowerCase())
2074
- );
2075
- schemaRegistry.add(organizationNameSchema, {
2076
- description: "The name of the organization"
2077
- });
2078
- var organizationDescriptionSchema = optional(
2079
- string2().check(_trim())
2080
- );
2081
- schemaRegistry.add(organizationDescriptionSchema, {
2082
- description: "A description of the organization"
2083
- });
2084
- var organizationLogoSchema = optional(url());
2085
- schemaRegistry.add(organizationLogoSchema, {
2086
- description: "A URL to the organization's logo image"
2087
- });
2088
- var organizationIconSchema = optional(url());
2089
- schemaRegistry.add(organizationIconSchema, {
2090
- description: "A URL to the organization's icon image"
2091
- });
2092
- var organizationUrlSchema = optional(url());
2093
- schemaRegistry.add(organizationUrlSchema, {
2094
- description: "A URL to a page that provides more information about the organization"
2095
- });
2096
- var organizationSchema = object({
2097
- name: organizationNameSchema,
2098
- description: organizationDescriptionSchema,
2099
- logo: organizationLogoSchema,
2100
- icon: organizationIconSchema,
2101
- url: organizationUrlSchema
2102
- });
2103
- schemaRegistry.add(organizationSchema, {
2104
- description: "The workspace's organization details"
2105
- });
2106
- var schemaNameSchema = _default(
2107
- string2().check(_trim(), _toLowerCase()),
2108
- "https://public.storm-cdn.com/schemas/storm-workspace.schema.json"
2109
- );
2110
- schemaRegistry.add(schemaNameSchema, {
2111
- description: "The URL or file path to the JSON schema file that describes the Storm configuration file"
2112
- });
2113
- var nameSchema = string2().check(_trim(), _toLowerCase());
2114
- schemaRegistry.add(nameSchema, {
2115
- description: "The name of the workspace/project/service/package/scope using this configuration"
2116
- });
2117
- var namespaceSchema = string2().check(_trim(), _toLowerCase());
2118
- schemaRegistry.add(namespaceSchema, {
2119
- description: "The namespace of the workspace/project/service/package/scope using this configuration"
2120
- });
2121
- var orgSchema = union([
2122
- organizationSchema,
2123
- string2().check(_trim(), _toLowerCase())
2124
- ]);
2125
- schemaRegistry.add(orgSchema, {
2126
- description: "The organization of the workspace. This can be a string or an object containing the organization's details"
2127
- });
2128
- var repositorySchema = string2().check(_trim(), _toLowerCase());
2129
- schemaRegistry.add(repositorySchema, {
2130
- description: "The repo URL of the workspace (i.e. the GitHub repository URL)"
2131
- });
2132
- var licenseSchema = _default(
2133
- string2().check(_trim()),
2134
- "Apache-2.0"
2135
- );
2136
- schemaRegistry.add(licenseSchema, {
2137
- description: "The license type of the package"
2138
- });
2139
- var homepageSchema = optional(url());
2140
- schemaRegistry.add(homepageSchema, {
2141
- description: "The homepage of the workspace"
2142
- });
2143
- var docsSchema = optional(url());
2144
- schemaRegistry.add(docsSchema, {
2145
- description: "The documentation site for the workspace"
2146
- });
2147
- var portalSchema = optional(url());
2148
- schemaRegistry.add(portalSchema, {
2149
- description: "The development portal site for the workspace"
2150
- });
2151
- var licensingSchema = optional(url());
2152
- schemaRegistry.add(licensingSchema, {
2153
- description: "The licensing site for the workspace"
2154
- });
2155
- var contactSchema = optional(url());
2156
- schemaRegistry.add(contactSchema, {
2157
- description: "The contact site for the workspace"
2158
- });
2159
- var supportSchema = optional(url());
2160
- schemaRegistry.add(supportSchema, {
2161
- description: "The support site for the workspace. If not provided, this is defaulted to the `contact` config value"
2162
- });
2163
- var branchSchema = _default(
2164
- string2().check(_trim(), _toLowerCase()),
2165
- "main"
2166
- );
2167
- schemaRegistry.add(branchSchema, {
2168
- description: "The branch of the workspace"
2169
- });
2170
- var preidSchema = optional(
2171
- string2().check(_trim(), _toLowerCase())
2172
- );
2173
- schemaRegistry.add(preidSchema, {
2174
- description: "A tag specifying the version pre-release identifier"
2175
- });
2176
- var ownerSchema = optional(
2177
- string2().check(_trim(), _toLowerCase())
2178
- );
2179
- schemaRegistry.add(ownerSchema, {
2180
- description: "The owner of the package"
2181
- });
2182
- var modeSchema = _default(
2183
- _enum(["development", "test", "production"]).check(_trim(), _toLowerCase()),
2184
- "production"
2185
- );
2186
- schemaRegistry.add(modeSchema, {
2187
- description: "The current runtime environment mode for the package"
2188
- });
2189
- var workspaceRootSchema = string2().check(_trim(), _toLowerCase());
2190
- schemaRegistry.add(workspaceRootSchema, {
2191
- description: "The root directory of the workspace"
2192
- });
2193
- var skipCacheSchema = _default(boolean2(), false);
2194
- schemaRegistry.add(skipCacheSchema, {
2195
- description: "Should all known types of workspace caching be skipped?"
2196
- });
2197
- var packageManagerSchema = _default(
2198
- _enum(["npm", "yarn", "pnpm", "bun"]),
2199
- "npm"
2200
- );
2201
- schemaRegistry.add(packageManagerSchema, {
2202
- description: "The JavaScript/TypeScript package manager used by the repository"
2203
- });
2204
- var timezoneSchema = _default(
2205
- string2().check(_trim()),
2206
- "America/New_York"
2207
- );
2208
- schemaRegistry.add(timezoneSchema, {
2209
- description: "The default timezone of the workspace"
2210
- });
2211
- var localeSchema = _default(string2().check(_trim()), "en-US");
2212
- schemaRegistry.add(localeSchema, {
2213
- description: "The default locale of the workspace"
2214
- });
2215
- var logLevelSchema = _default(
2216
- _enum([
2217
- "silent",
2218
- "fatal",
2219
- "error",
2220
- "warn",
2221
- "success",
2222
- "info",
2223
- "performance",
2224
- "debug",
2225
- "trace",
2226
- "all"
2227
- ]),
2228
- "info"
2229
- );
2230
- schemaRegistry.add(logLevelSchema, {
2231
- description: "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`)."
2232
- });
2233
- var skipConfigLoggingSchema = _default(boolean2(), true);
2234
- schemaRegistry.add(skipConfigLoggingSchema, {
2235
- description: "Should the logging of the current Storm Workspace configuration be skipped?"
2236
- });
2237
- var configFileSchema = _default(
2238
- nullable(string2().check(_trim())),
2239
- null
2240
- );
2241
- schemaRegistry.add(configFileSchema, {
2242
- description: "The filepath of the Storm config. When this field is null, no config file was found in the current workspace."
2243
- });
2244
- var extensionsSchema = _default(record(string2(), any()), {});
2245
- schemaRegistry.add(extensionsSchema, {
2246
- description: "Configuration of each used extension"
2247
- });
2248
- var workspaceConfigSchema = object({
2249
- $schema: schemaNameSchema,
2250
- extends: extendsSchema,
2251
- name: nameSchema,
2252
- variant: variantSchema,
2253
- namespace: namespaceSchema,
2254
- organization: orgSchema,
2255
- repository: repositorySchema,
2256
- license: licenseSchema,
2257
- homepage: homepageSchema,
2258
- docs: docsSchema,
2259
- portal: portalSchema,
2260
- licensing: licensingSchema,
2261
- contact: contactSchema,
2262
- support: supportSchema,
2263
- branch: branchSchema,
2264
- preid: preidSchema,
2265
- owner: ownerSchema,
2266
- bot: workspaceBotSchema,
2267
- release: workspaceReleaseSchema,
2268
- socials: workspaceSocialsSchema,
2269
- error: errorSchema,
2270
- mode: modeSchema,
2271
- workspaceRoot: workspaceRootSchema,
2272
- skipCache: skipCacheSchema,
2273
- directories: workspaceDirectorySchema,
2274
- packageManager: packageManagerSchema,
2275
- timezone: timezoneSchema,
2276
- locale: localeSchema,
2277
- logLevel: logLevelSchema,
2278
- skipConfigLogging: skipConfigLoggingSchema,
2279
- registry: registrySchema,
2280
- configFile: configFileSchema,
2281
- colors: union([colorsSchema, themeColorsSchema]),
2282
- extensions: extensionsSchema
2283
- });
2284
- schemaRegistry.add(extensionsSchema, {
2285
- description: "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."
2286
- });
2287
-
2288
- // ../config/src/types.ts
2289
- var COLOR_KEYS = [
2290
- "dark",
2291
- "light",
2292
- "base",
2293
- "brand",
2294
- "alternate",
2295
- "accent",
2296
- "link",
2297
- "success",
2298
- "discovery",
2299
- "info",
2300
- "warning",
2301
- "danger",
2302
- "fatal",
2303
- "performance",
2304
- "positive",
2305
- "negative"
2306
- ];
2307
- async function getPackageJsonConfig(root) {
2308
- let license = STORM_DEFAULT_LICENSE;
2309
- let homepage = void 0;
2310
- let support = void 0;
2311
- let name = void 0;
2312
- let namespace = void 0;
2313
- let repository = void 0;
2314
- const workspaceRoot = findWorkspaceRoot(root);
2315
- if (existsSync$1(join(workspaceRoot, "package.json"))) {
2316
- const file = await readFile(
2317
- joinPaths(workspaceRoot, "package.json"),
2318
- "utf8"
2319
- );
2320
- if (file) {
2321
- const packageJson = JSON.parse(file);
2322
- if (packageJson.name) {
2323
- name = packageJson.name;
2324
- }
2325
- if (packageJson.namespace) {
2326
- namespace = packageJson.namespace;
2327
- }
2328
- if (packageJson.repository) {
2329
- if (typeof packageJson.repository === "string") {
2330
- repository = packageJson.repository;
2331
- } else if (packageJson.repository.url) {
2332
- repository = packageJson.repository.url;
2333
- }
2334
- }
2335
- if (packageJson.license) {
2336
- license = packageJson.license;
2337
- }
2338
- if (packageJson.homepage) {
2339
- homepage = packageJson.homepage;
2340
- }
2341
- if (packageJson.bugs) {
2342
- if (typeof packageJson.bugs === "string") {
2343
- support = packageJson.bugs;
2344
- } else if (packageJson.bugs.url) {
2345
- support = packageJson.bugs.url;
2346
- }
2347
- }
2348
- }
2349
- }
2350
- return {
2351
- workspaceRoot,
2352
- name,
2353
- namespace,
2354
- repository,
2355
- license,
2356
- homepage,
2357
- support
2358
- };
2359
- }
2360
- function applyDefaultConfig(config2) {
2361
- if (!config2.support && config2.contact) {
2362
- config2.support = config2.contact;
2363
- }
2364
- if (!config2.contact && config2.support) {
2365
- config2.contact = config2.support;
2366
- }
2367
- if (config2.homepage) {
2368
- if (!config2.docs) {
2369
- config2.docs = `${config2.homepage}/docs`;
2370
- }
2371
- if (!config2.license) {
2372
- config2.license = `${config2.homepage}/license`;
2373
- }
2374
- if (!config2.support) {
2375
- config2.support = `${config2.homepage}/support`;
2376
- }
2377
- if (!config2.contact) {
2378
- config2.contact = `${config2.homepage}/contact`;
2379
- }
2380
- if (!config2.error?.codesFile || !config2?.error?.url) {
2381
- config2.error ??= { codesFile: STORM_DEFAULT_ERROR_CODES_FILE };
2382
- if (config2.homepage) {
2383
- config2.error.url ??= `${config2.homepage}/errors`;
2384
- }
2385
- }
2386
- }
2387
- return config2;
2388
- }
2389
-
2390
- // ../config-tools/src/config-file/get-config-file.ts
2391
- var getConfigFileByName = async (fileName, filePath, options = {}) => {
2392
- const workspacePath = filePath || findWorkspaceRoot(filePath);
2393
- const configs = await Promise.all([
2394
- loadConfig({
2395
- cwd: workspacePath,
2396
- packageJson: true,
2397
- name: fileName,
2398
- envName: fileName?.toUpperCase(),
2399
- jitiOptions: {
2400
- debug: false,
2401
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
2402
- process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
2403
- "jiti"
2404
- )
2405
- },
2406
- ...options
2407
- }),
2408
- loadConfig({
2409
- cwd: workspacePath,
2410
- packageJson: true,
2411
- name: fileName,
2412
- envName: fileName?.toUpperCase(),
2413
- jitiOptions: {
2414
- debug: false,
2415
- fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
2416
- process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
2417
- "jiti"
2418
- )
2419
- },
2420
- configFile: fileName,
2421
- ...options
2422
- })
2423
- ]);
2424
- return defu3(configs[0] ?? {}, configs[1] ?? {});
2425
- };
2426
- var getConfigFile = async (filePath, additionalFileNames = []) => {
2427
- const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
2428
- const result = await getConfigFileByName("storm-workspace", workspacePath);
2429
- let config2 = result.config;
2430
- const configFile = result.configFile;
2431
- if (config2 && configFile && Object.keys(config2).length > 0 && !config2.skipConfigLogging) {
2432
- writeTrace(
2433
- `Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`,
2434
- {
2435
- logLevel: "all"
2436
- }
2437
- );
2438
- }
2439
- if (additionalFileNames && additionalFileNames.length > 0) {
2440
- const results = await Promise.all(
2441
- additionalFileNames.map(
2442
- (fileName) => getConfigFileByName(fileName, workspacePath)
2443
- )
2444
- );
2445
- for (const result2 of results) {
2446
- if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
2447
- if (!config2.skipConfigLogging && !result2.config.skipConfigLogging) {
2448
- writeTrace(
2449
- `Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`,
2450
- {
2451
- logLevel: "all"
2452
- }
2453
- );
2454
- }
2455
- config2 = defu3(result2.config ?? {}, config2 ?? {});
2456
- }
2457
- }
2458
- }
2459
- if (!config2 || Object.keys(config2).length === 0) {
2460
- return void 0;
2461
- }
2462
- config2.configFile = configFile;
2463
- return config2;
2464
- };
2465
- var getConfigEnv = () => {
2466
- const prefix = "STORM_";
2467
- let config2 = {
2468
- extends: process.env[`${prefix}EXTENDS`] || void 0,
2469
- name: process.env[`${prefix}NAME`] || void 0,
2470
- variant: process.env[`${prefix}VARIANT`] || void 0,
2471
- namespace: process.env[`${prefix}NAMESPACE`] || void 0,
2472
- owner: process.env[`${prefix}OWNER`] || void 0,
2473
- bot: {
2474
- name: process.env[`${prefix}BOT_NAME`] || void 0,
2475
- email: process.env[`${prefix}BOT_EMAIL`] || void 0
2476
- },
2477
- release: {
2478
- banner: {
2479
- url: process.env[`${prefix}RELEASE_BANNER_URL`] || void 0,
2480
- alt: process.env[`${prefix}RELEASE_BANNER_ALT`] || void 0
2481
- },
2482
- header: process.env[`${prefix}RELEASE_HEADER`] || void 0,
2483
- footer: process.env[`${prefix}RELEASE_FOOTER`] || void 0
2484
- },
2485
- error: {
2486
- codesFile: process.env[`${prefix}ERROR_CODES_FILE`] || void 0,
2487
- url: process.env[`${prefix}ERROR_URL`] || void 0
2488
- },
2489
- socials: {
2490
- twitter: process.env[`${prefix}SOCIAL_TWITTER`] || void 0,
2491
- discord: process.env[`${prefix}SOCIAL_DISCORD`] || void 0,
2492
- telegram: process.env[`${prefix}SOCIAL_TELEGRAM`] || void 0,
2493
- slack: process.env[`${prefix}SOCIAL_SLACK`] || void 0,
2494
- medium: process.env[`${prefix}SOCIAL_MEDIUM`] || void 0,
2495
- github: process.env[`${prefix}SOCIAL_GITHUB`] || void 0
2496
- },
2497
- organization: process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`] ? process.env[`${prefix}ORG_DESCRIPTION`] || process.env[`${prefix}ORGANIZATION_DESCRIPTION`] || process.env[`${prefix}ORG_URL`] || process.env[`${prefix}ORGANIZATION_URL`] || process.env[`${prefix}ORG_LOGO`] || process.env[`${prefix}ORGANIZATION_LOGO`] ? {
2498
- name: process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`],
2499
- description: process.env[`${prefix}ORG_DESCRIPTION`] || process.env[`${prefix}ORGANIZATION_DESCRIPTION`] || void 0,
2500
- url: process.env[`${prefix}ORG_URL`] || process.env[`${prefix}ORGANIZATION_URL`] || void 0,
2501
- logo: process.env[`${prefix}ORG_LOGO`] || process.env[`${prefix}ORGANIZATION_LOGO`] || void 0,
2502
- icon: process.env[`${prefix}ORG_ICON`] || process.env[`${prefix}ORGANIZATION_ICON`] || void 0
2503
- } : process.env[`${prefix}ORG`] || process.env[`${prefix}ORGANIZATION`] || process.env[`${prefix}ORG_NAME`] || process.env[`${prefix}ORGANIZATION_NAME`] : void 0,
2504
- packageManager: process.env[`${prefix}PACKAGE_MANAGER`] || void 0,
2505
- license: process.env[`${prefix}LICENSE`] || void 0,
2506
- homepage: process.env[`${prefix}HOMEPAGE`] || void 0,
2507
- docs: process.env[`${prefix}DOCS`] || void 0,
2508
- portal: process.env[`${prefix}PORTAL`] || void 0,
2509
- licensing: process.env[`${prefix}LICENSING`] || void 0,
2510
- contact: process.env[`${prefix}CONTACT`] || void 0,
2511
- support: process.env[`${prefix}SUPPORT`] || void 0,
2512
- timezone: process.env[`${prefix}TIMEZONE`] || process.env.TZ || void 0,
2513
- locale: process.env[`${prefix}LOCALE`] || process.env.LOCALE || void 0,
2514
- configFile: process.env[`${prefix}WORKSPACE_CONFIG_FILE`] ? correctPaths(process.env[`${prefix}WORKSPACE_CONFIG_FILE`]) : void 0,
2515
- workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`] ? correctPaths(process.env[`${prefix}WORKSPACE_ROOT`]) : void 0,
2516
- directories: {
2517
- cache: process.env[`${prefix}CACHE_DIR`] ? correctPaths(process.env[`${prefix}CACHE_DIR`]) : process.env[`${prefix}CACHE_DIRECTORY`] ? correctPaths(process.env[`${prefix}CACHE_DIRECTORY`]) : void 0,
2518
- data: process.env[`${prefix}DATA_DIR`] ? correctPaths(process.env[`${prefix}DATA_DIR`]) : process.env[`${prefix}DATA_DIRECTORY`] ? correctPaths(process.env[`${prefix}DATA_DIRECTORY`]) : void 0,
2519
- config: process.env[`${prefix}CONFIG_DIR`] ? correctPaths(process.env[`${prefix}CONFIG_DIR`]) : process.env[`${prefix}CONFIG_DIRECTORY`] ? correctPaths(process.env[`${prefix}CONFIG_DIRECTORY`]) : void 0,
2520
- temp: process.env[`${prefix}TEMP_DIR`] ? correctPaths(process.env[`${prefix}TEMP_DIR`]) : process.env[`${prefix}TEMP_DIRECTORY`] ? correctPaths(process.env[`${prefix}TEMP_DIRECTORY`]) : void 0,
2521
- log: process.env[`${prefix}LOG_DIR`] ? correctPaths(process.env[`${prefix}LOG_DIR`]) : process.env[`${prefix}LOG_DIRECTORY`] ? correctPaths(process.env[`${prefix}LOG_DIRECTORY`]) : void 0,
2522
- build: process.env[`${prefix}BUILD_DIR`] ? correctPaths(process.env[`${prefix}BUILD_DIR`]) : process.env[`${prefix}BUILD_DIRECTORY`] ? correctPaths(process.env[`${prefix}BUILD_DIRECTORY`]) : void 0
2523
- },
2524
- skipCache: process.env[`${prefix}SKIP_CACHE`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CACHE`]) : void 0,
2525
- mode: (process.env[`${prefix}MODE`] ?? process.env.NODE_ENV ?? process.env.ENVIRONMENT) || void 0,
2526
- // ci:
2527
- // process.env[`${prefix}CI`] !== undefined
2528
- // ? Boolean(
2529
- // process.env[`${prefix}CI`] ??
2530
- // process.env.CI ??
2531
- // process.env.CONTINUOUS_INTEGRATION
2532
- // )
2533
- // : undefined,
2534
- repository: process.env[`${prefix}REPOSITORY`] || void 0,
2535
- branch: process.env[`${prefix}BRANCH`] || void 0,
2536
- preid: process.env[`${prefix}PRE_ID`] || void 0,
2537
- registry: {
2538
- github: process.env[`${prefix}REGISTRY_GITHUB`] || void 0,
2539
- npm: process.env[`${prefix}REGISTRY_NPM`] || void 0,
2540
- cargo: process.env[`${prefix}REGISTRY_CARGO`] || void 0,
2541
- cyclone: process.env[`${prefix}REGISTRY_CYCLONE`] || void 0,
2542
- container: process.env[`${prefix}REGISTRY_CONTAINER`] || void 0
2543
- },
2544
- logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(
2545
- Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
2546
- ) ? getLogLevelLabel(
2547
- Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
2548
- ) : process.env[`${prefix}LOG_LEVEL`] : void 0,
2549
- skipConfigLogging: process.env[`${prefix}SKIP_CONFIG_LOGGING`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CONFIG_LOGGING`]) : void 0
2550
- };
2551
- const themeNames = Object.keys(process.env).filter(
2552
- (envKey) => envKey.startsWith(`${prefix}COLOR_`) && COLOR_KEYS.every(
2553
- (colorKey) => !envKey.startsWith(`${prefix}COLOR_LIGHT_${colorKey}`) && !envKey.startsWith(`${prefix}COLOR_DARK_${colorKey}`)
2554
- )
2555
- );
2556
- config2.colors = themeNames.length > 0 ? themeNames.reduce(
2557
- (ret, themeName) => {
2558
- ret[themeName] = getThemeColorsEnv(prefix, themeName);
2559
- return ret;
2560
- },
2561
- {}
2562
- ) : getThemeColorsEnv(prefix);
2563
- if (config2.docs === STORM_DEFAULT_DOCS) {
2564
- if (config2.homepage === STORM_DEFAULT_HOMEPAGE) {
2565
- config2.docs = `${STORM_DEFAULT_HOMEPAGE}/projects/${config2.name}/docs`;
2566
- } else {
2567
- config2.docs = `${config2.homepage}/docs`;
2568
- }
2569
- }
2570
- if (config2.licensing === STORM_DEFAULT_LICENSING) {
2571
- if (config2.homepage === STORM_DEFAULT_HOMEPAGE) {
2572
- config2.licensing = `${STORM_DEFAULT_HOMEPAGE}/projects/${config2.name}/licensing`;
2573
- } else {
2574
- config2.licensing = `${config2.homepage}/docs`;
2575
- }
2576
- }
2577
- const serializedConfig = process.env[`${prefix}WORKSPACE_CONFIG`];
2578
- if (serializedConfig) {
2579
- const parsed = JSON.parse(serializedConfig);
2580
- config2 = {
2581
- ...config2,
2582
- ...parsed,
2583
- colors: { ...config2.colors, ...parsed.colors },
2584
- extensions: { ...config2.extensions, ...parsed.extensions }
2585
- };
2586
- }
2587
- return config2;
2588
- };
2589
- var getThemeColorsEnv = (prefix, theme) => {
2590
- const themeName = `COLOR_${theme && theme !== "base" ? `${theme}_` : ""}`.toUpperCase();
2591
- return process.env[`${prefix}${themeName}LIGHT_BRAND`] || process.env[`${prefix}${themeName}DARK_BRAND`] ? getMultiThemeColorsEnv(prefix + themeName) : getSingleThemeColorsEnv(prefix + themeName);
2592
- };
2593
- var getSingleThemeColorsEnv = (prefix) => {
2594
- const gradient = [];
2595
- if (process.env[`${prefix}GRADIENT_START`] && process.env[`${prefix}GRADIENT_END`]) {
2596
- gradient.push(
2597
- process.env[`${prefix}GRADIENT_START`],
2598
- process.env[`${prefix}GRADIENT_END`]
2599
- );
2600
- } else if (process.env[`${prefix}GRADIENT_0`] || process.env[`${prefix}GRADIENT_1`]) {
2601
- let index = process.env[`${prefix}GRADIENT_0`] ? 0 : 1;
2602
- while (process.env[`${prefix}GRADIENT_${index}`]) {
2603
- gradient.push(process.env[`${prefix}GRADIENT_${index}`]);
2604
- index++;
2605
- }
2606
- }
2607
- return {
2608
- dark: process.env[`${prefix}DARK`],
2609
- light: process.env[`${prefix}LIGHT`],
2610
- brand: process.env[`${prefix}BRAND`],
2611
- alternate: process.env[`${prefix}ALTERNATE`],
2612
- accent: process.env[`${prefix}ACCENT`],
2613
- link: process.env[`${prefix}LINK`],
2614
- discovery: process.env[`${prefix}DISCOVERY`],
2615
- success: process.env[`${prefix}SUCCESS`],
2616
- info: process.env[`${prefix}INFO`],
2617
- debug: process.env[`${prefix}DEBUG`],
2618
- warning: process.env[`${prefix}WARNING`],
2619
- danger: process.env[`${prefix}DANGER`],
2620
- fatal: process.env[`${prefix}FATAL`],
2621
- performance: process.env[`${prefix}PERFORMANCE`],
2622
- positive: process.env[`${prefix}POSITIVE`],
2623
- negative: process.env[`${prefix}NEGATIVE`],
2624
- gradient
2625
- };
2626
- };
2627
- var getMultiThemeColorsEnv = (prefix) => {
2628
- return {
2629
- light: getBaseThemeColorsEnv(`${prefix}_LIGHT_`),
2630
- dark: getBaseThemeColorsEnv(`${prefix}_DARK_`)
2631
- };
2632
- };
2633
- var getBaseThemeColorsEnv = (prefix) => {
2634
- const gradient = [];
2635
- if (process.env[`${prefix}GRADIENT_START`] && process.env[`${prefix}GRADIENT_END`]) {
2636
- gradient.push(
2637
- process.env[`${prefix}GRADIENT_START`],
2638
- process.env[`${prefix}GRADIENT_END`]
2639
- );
2640
- } else if (process.env[`${prefix}GRADIENT_0`] || process.env[`${prefix}GRADIENT_1`]) {
2641
- let index = process.env[`${prefix}GRADIENT_0`] ? 0 : 1;
2642
- while (process.env[`${prefix}GRADIENT_${index}`]) {
2643
- gradient.push(process.env[`${prefix}GRADIENT_${index}`]);
2644
- index++;
2645
- }
2646
- }
2647
- return {
2648
- foreground: process.env[`${prefix}FOREGROUND`],
2649
- background: process.env[`${prefix}BACKGROUND`],
2650
- brand: process.env[`${prefix}BRAND`],
2651
- alternate: process.env[`${prefix}ALTERNATE`],
2652
- accent: process.env[`${prefix}ACCENT`],
2653
- link: process.env[`${prefix}LINK`],
2654
- discovery: process.env[`${prefix}DISCOVERY`],
2655
- success: process.env[`${prefix}SUCCESS`],
2656
- info: process.env[`${prefix}INFO`],
2657
- debug: process.env[`${prefix}DEBUG`],
2658
- warning: process.env[`${prefix}WARNING`],
2659
- danger: process.env[`${prefix}DANGER`],
2660
- fatal: process.env[`${prefix}FATAL`],
2661
- performance: process.env[`${prefix}PERFORMANCE`],
2662
- positive: process.env[`${prefix}POSITIVE`],
2663
- negative: process.env[`${prefix}NEGATIVE`],
2664
- gradient
2665
- };
2666
- };
2667
-
2668
- // ../config-tools/src/env/set-env.ts
2669
- var setExtensionEnv = (extensionName, extension) => {
2670
- for (const key of Object.keys(extension ?? {})) {
2671
- if (extension[key]) {
2672
- const result = key?.replace(
2673
- /([A-Z])+/g,
2674
- (input) => input ? input[0]?.toUpperCase() + input.slice(1) : ""
2675
- ).split(/(?=[A-Z])|[.\-\s_]/).map((x) => x.toLowerCase()) ?? [];
2676
- let extensionKey;
2677
- if (result.length === 0) {
2678
- return;
2679
- }
2680
- if (result.length === 1) {
2681
- extensionKey = result[0]?.toUpperCase() ?? "";
2682
- } else {
2683
- extensionKey = result.reduce((ret, part) => {
2684
- return `${ret}_${part.toLowerCase()}`;
2685
- });
2686
- }
2687
- process.env[`STORM_EXTENSION_${extensionName.toUpperCase()}_${extensionKey.toUpperCase()}`] = extension[key];
2688
- }
2689
- }
2690
- };
2691
- var setConfigEnv = (config2) => {
2692
- const prefix = "STORM_";
2693
- if (config2.extends) {
2694
- process.env[`${prefix}EXTENDS`] = Array.isArray(config2.extends) ? JSON.stringify(config2.extends) : config2.extends;
2695
- }
2696
- if (config2.name) {
2697
- process.env[`${prefix}NAME`] = config2.name;
2698
- }
2699
- if (config2.variant) {
2700
- process.env[`${prefix}VARIANT`] = config2.variant;
2701
- }
2702
- if (config2.namespace) {
2703
- process.env[`${prefix}NAMESPACE`] = config2.namespace;
2704
- }
2705
- if (config2.owner) {
2706
- process.env[`${prefix}OWNER`] = config2.owner;
2707
- }
2708
- if (config2.bot) {
2709
- process.env[`${prefix}BOT_NAME`] = config2.bot.name;
2710
- process.env[`${prefix}BOT_EMAIL`] = config2.bot.email;
2711
- }
2712
- if (config2.error) {
2713
- process.env[`${prefix}ERROR_CODES_FILE`] = config2.error.codesFile;
2714
- process.env[`${prefix}ERROR_URL`] = config2.error.url;
2715
- }
2716
- if (config2.release) {
2717
- if (config2.release.banner) {
2718
- if (typeof config2.release.banner === "string") {
2719
- process.env[`${prefix}RELEASE_BANNER`] = config2.release.banner;
2720
- process.env[`${prefix}RELEASE_BANNER_URL`] = config2.release.banner;
2721
- } else {
2722
- process.env[`${prefix}RELEASE_BANNER`] = config2.release.banner.url;
2723
- process.env[`${prefix}RELEASE_BANNER_URL`] = config2.release.banner.url;
2724
- process.env[`${prefix}RELEASE_BANNER_ALT`] = config2.release.banner.alt;
2725
- }
2726
- }
2727
- process.env[`${prefix}RELEASE_HEADER`] = config2.release.header;
2728
- process.env[`${prefix}RELEASE_FOOTER`] = config2.release.footer;
2729
- }
2730
- if (config2.socials) {
2731
- if (config2.socials.twitter) {
2732
- process.env[`${prefix}SOCIAL_TWITTER`] = config2.socials.twitter;
2733
- }
2734
- if (config2.socials.discord) {
2735
- process.env[`${prefix}SOCIAL_DISCORD`] = config2.socials.discord;
2736
- }
2737
- if (config2.socials.telegram) {
2738
- process.env[`${prefix}SOCIAL_TELEGRAM`] = config2.socials.telegram;
2739
- }
2740
- if (config2.socials.slack) {
2741
- process.env[`${prefix}SOCIAL_SLACK`] = config2.socials.slack;
2742
- }
2743
- if (config2.socials.medium) {
2744
- process.env[`${prefix}SOCIAL_MEDIUM`] = config2.socials.medium;
2745
- }
2746
- if (config2.socials.github) {
2747
- process.env[`${prefix}SOCIAL_GITHUB`] = config2.socials.github;
2748
- }
2749
- }
2750
- if (config2.organization) {
2751
- if (typeof config2.organization === "string") {
2752
- process.env[`${prefix}ORG`] = config2.organization;
2753
- process.env[`${prefix}ORG_NAME`] = config2.organization;
2754
- process.env[`${prefix}ORGANIZATION`] = config2.organization;
2755
- process.env[`${prefix}ORGANIZATION_NAME`] = config2.organization;
2756
- } else {
2757
- process.env[`${prefix}ORG`] = config2.organization.name;
2758
- process.env[`${prefix}ORG_NAME`] = config2.organization.name;
2759
- process.env[`${prefix}ORGANIZATION`] = config2.organization.name;
2760
- process.env[`${prefix}ORGANIZATION_NAME`] = config2.organization.name;
2761
- if (config2.organization.url) {
2762
- process.env[`${prefix}ORG_URL`] = config2.organization.url;
2763
- process.env[`${prefix}ORGANIZATION_URL`] = config2.organization.url;
2764
- }
2765
- if (config2.organization.description) {
2766
- process.env[`${prefix}ORG_DESCRIPTION`] = config2.organization.description;
2767
- process.env[`${prefix}ORGANIZATION_DESCRIPTION`] = config2.organization.description;
2768
- }
2769
- if (config2.organization.logo) {
2770
- process.env[`${prefix}ORG_LOGO`] = config2.organization.logo;
2771
- process.env[`${prefix}ORGANIZATION_LOGO`] = config2.organization.logo;
2772
- }
2773
- if (config2.organization.icon) {
2774
- process.env[`${prefix}ORG_ICON`] = config2.organization.icon;
2775
- process.env[`${prefix}ORGANIZATION_ICON`] = config2.organization.icon;
2776
- }
2777
- }
2778
- }
2779
- if (config2.packageManager) {
2780
- process.env[`${prefix}PACKAGE_MANAGER`] = config2.packageManager;
2781
- }
2782
- if (config2.license) {
2783
- process.env[`${prefix}LICENSE`] = config2.license;
2784
- }
2785
- if (config2.homepage) {
2786
- process.env[`${prefix}HOMEPAGE`] = config2.homepage;
2787
- }
2788
- if (config2.docs) {
2789
- process.env[`${prefix}DOCS`] = config2.docs;
2790
- }
2791
- if (config2.portal) {
2792
- process.env[`${prefix}PORTAL`] = config2.portal;
2793
- }
2794
- if (config2.licensing) {
2795
- process.env[`${prefix}LICENSING`] = config2.licensing;
2796
- }
2797
- if (config2.contact) {
2798
- process.env[`${prefix}CONTACT`] = config2.contact;
2799
- }
2800
- if (config2.support) {
2801
- process.env[`${prefix}SUPPORT`] = config2.support;
2802
- }
2803
- if (config2.timezone) {
2804
- process.env[`${prefix}TIMEZONE`] = config2.timezone;
2805
- process.env.TZ = config2.timezone;
2806
- process.env.DEFAULT_TIMEZONE = config2.timezone;
2807
- process.env.TIMEZONE = config2.timezone;
2808
- }
2809
- if (config2.locale) {
2810
- process.env[`${prefix}LOCALE`] = config2.locale;
2811
- process.env.DEFAULT_LOCALE = config2.locale;
2812
- process.env.LOCALE = config2.locale;
2813
- process.env.LANG = config2.locale ? `${config2.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
2814
- }
2815
- if (config2.configFile) {
2816
- process.env[`${prefix}WORKSPACE_CONFIG_FILE`] = correctPaths(
2817
- config2.configFile
2818
- );
2819
- }
2820
- if (config2.workspaceRoot) {
2821
- process.env[`${prefix}WORKSPACE_ROOT`] = correctPaths(config2.workspaceRoot);
2822
- process.env.NX_WORKSPACE_ROOT = correctPaths(config2.workspaceRoot);
2823
- process.env.NX_WORKSPACE_ROOT_PATH = correctPaths(config2.workspaceRoot);
2824
- }
2825
- if (config2.directories) {
2826
- if (!config2.skipCache && config2.directories.cache) {
2827
- process.env[`${prefix}CACHE_DIR`] = correctPaths(
2828
- config2.directories.cache
2829
- );
2830
- process.env[`${prefix}CACHE_DIRECTORY`] = process.env[`${prefix}CACHE_DIR`];
2831
- }
2832
- if (config2.directories.data) {
2833
- process.env[`${prefix}DATA_DIR`] = correctPaths(config2.directories.data);
2834
- process.env[`${prefix}DATA_DIRECTORY`] = process.env[`${prefix}DATA_DIR`];
2835
- }
2836
- if (config2.directories.config) {
2837
- process.env[`${prefix}CONFIG_DIR`] = correctPaths(
2838
- config2.directories.config
2839
- );
2840
- process.env[`${prefix}CONFIG_DIRECTORY`] = process.env[`${prefix}CONFIG_DIR`];
2841
- }
2842
- if (config2.directories.temp) {
2843
- process.env[`${prefix}TEMP_DIR`] = correctPaths(config2.directories.temp);
2844
- process.env[`${prefix}TEMP_DIRECTORY`] = process.env[`${prefix}TEMP_DIR`];
2845
- }
2846
- if (config2.directories.log) {
2847
- process.env[`${prefix}LOG_DIR`] = correctPaths(config2.directories.log);
2848
- process.env[`${prefix}LOG_DIRECTORY`] = process.env[`${prefix}LOG_DIR`];
2849
- }
2850
- if (config2.directories.build) {
2851
- process.env[`${prefix}BUILD_DIR`] = correctPaths(
2852
- config2.directories.build
2853
- );
2854
- process.env[`${prefix}BUILD_DIRECTORY`] = process.env[`${prefix}BUILD_DIR`];
2855
- }
2856
- }
2857
- if (config2.skipCache !== void 0) {
2858
- process.env[`${prefix}SKIP_CACHE`] = String(config2.skipCache);
2859
- if (config2.skipCache) {
2860
- process.env.NX_SKIP_NX_CACHE ??= String(config2.skipCache);
2861
- process.env.NX_CACHE_PROJECT_GRAPH ??= String(config2.skipCache);
2862
- }
2863
- }
2864
- if (config2.mode) {
2865
- process.env[`${prefix}MODE`] = config2.mode;
2866
- process.env.NODE_ENV = config2.mode;
2867
- process.env.ENVIRONMENT = config2.mode;
2868
- }
2869
- if (config2.colors?.base?.light || config2.colors?.base?.dark) {
2870
- for (const key of Object.keys(config2.colors)) {
2871
- setThemeColorsEnv(`${prefix}COLOR_${key}_`, config2.colors[key]);
2872
- }
2873
- } else {
2874
- setThemeColorsEnv(
2875
- `${prefix}COLOR_`,
2876
- config2.colors
2877
- );
2878
- }
2879
- if (config2.repository) {
2880
- process.env[`${prefix}REPOSITORY`] = config2.repository;
2881
- }
2882
- if (config2.branch) {
2883
- process.env[`${prefix}BRANCH`] = config2.branch;
2884
- }
2885
- if (config2.preid) {
2886
- process.env[`${prefix}PRE_ID`] = String(config2.preid);
2887
- }
2888
- if (config2.registry) {
2889
- if (config2.registry.github) {
2890
- process.env[`${prefix}REGISTRY_GITHUB`] = String(config2.registry.github);
2891
- }
2892
- if (config2.registry.npm) {
2893
- process.env[`${prefix}REGISTRY_NPM`] = String(config2.registry.npm);
2894
- }
2895
- if (config2.registry.cargo) {
2896
- process.env[`${prefix}REGISTRY_CARGO`] = String(config2.registry.cargo);
2897
- }
2898
- if (config2.registry.cyclone) {
2899
- process.env[`${prefix}REGISTRY_CYCLONE`] = String(
2900
- config2.registry.cyclone
2901
- );
2902
- }
2903
- if (config2.registry.container) {
2904
- process.env[`${prefix}REGISTRY_CONTAINER`] = String(
2905
- config2.registry.container
2906
- );
2907
- }
2908
- }
2909
- if (config2.logLevel) {
2910
- process.env[`${prefix}LOG_LEVEL`] = String(config2.logLevel);
2911
- process.env.LOG_LEVEL = String(config2.logLevel);
2912
- process.env.NX_VERBOSE_LOGGING = String(
2913
- getLogLevel(config2.logLevel) >= LogLevel.DEBUG ? true : false
2914
- );
2915
- process.env.RUST_BACKTRACE = getLogLevel(config2.logLevel) >= LogLevel.DEBUG ? "full" : "none";
2916
- }
2917
- if (config2.skipConfigLogging !== void 0) {
2918
- process.env[`${prefix}SKIP_CONFIG_LOGGING`] = String(
2919
- config2.skipConfigLogging
2920
- );
2921
- }
2922
- process.env[`${prefix}WORKSPACE_CONFIG`] = JSON.stringify(config2);
2923
- for (const key of Object.keys(config2.extensions ?? {})) {
2924
- if (config2.extensions[key] && Object.keys(config2.extensions[key])) {
2925
- setExtensionEnv(key, config2.extensions[key]);
2926
- }
2927
- }
2928
- };
2929
- var setThemeColorsEnv = (prefix, config2) => {
2930
- return config2?.light?.brand || config2?.dark?.brand ? setMultiThemeColorsEnv(prefix, config2) : setSingleThemeColorsEnv(prefix, config2);
2931
- };
2932
- var setSingleThemeColorsEnv = (prefix, config2) => {
2933
- if (config2.dark) {
2934
- process.env[`${prefix}DARK`] = config2.dark;
2935
- }
2936
- if (config2.light) {
2937
- process.env[`${prefix}LIGHT`] = config2.light;
2938
- }
2939
- if (config2.brand) {
2940
- process.env[`${prefix}BRAND`] = config2.brand;
2941
- }
2942
- if (config2.alternate) {
2943
- process.env[`${prefix}ALTERNATE`] = config2.alternate;
2944
- }
2945
- if (config2.accent) {
2946
- process.env[`${prefix}ACCENT`] = config2.accent;
2947
- }
2948
- if (config2.link) {
2949
- process.env[`${prefix}LINK`] = config2.link;
2950
- }
2951
- if (config2.discovery) {
2952
- process.env[`${prefix}DISCOVERY`] = config2.discovery;
2953
- }
2954
- if (config2.success) {
2955
- process.env[`${prefix}SUCCESS`] = config2.success;
2956
- }
2957
- if (config2.info) {
2958
- process.env[`${prefix}INFO`] = config2.info;
2959
- }
2960
- if (config2.debug) {
2961
- process.env[`${prefix}DEBUG`] = config2.debug;
2962
- }
2963
- if (config2.warning) {
2964
- process.env[`${prefix}WARNING`] = config2.warning;
2965
- }
2966
- if (config2.danger) {
2967
- process.env[`${prefix}DANGER`] = config2.danger;
2968
- }
2969
- if (config2.fatal) {
2970
- process.env[`${prefix}FATAL`] = config2.fatal;
2971
- }
2972
- if (config2.performance) {
2973
- process.env[`${prefix}PERFORMANCE`] = config2.performance;
2974
- }
2975
- if (config2.positive) {
2976
- process.env[`${prefix}POSITIVE`] = config2.positive;
2977
- }
2978
- if (config2.negative) {
2979
- process.env[`${prefix}NEGATIVE`] = config2.negative;
2980
- }
2981
- if (config2.gradient) {
2982
- for (let i = 0; i < config2.gradient.length; i++) {
2983
- process.env[`${prefix}GRADIENT_${i}`] = config2.gradient[i];
2984
- }
2985
- }
2986
- };
2987
- var setMultiThemeColorsEnv = (prefix, config2) => {
2988
- return {
2989
- light: setBaseThemeColorsEnv(`${prefix}LIGHT_`, config2.light),
2990
- dark: setBaseThemeColorsEnv(`${prefix}DARK_`, config2.dark)
2991
- };
2992
- };
2993
- var setBaseThemeColorsEnv = (prefix, config2) => {
2994
- if (config2.foreground) {
2995
- process.env[`${prefix}FOREGROUND`] = config2.foreground;
2996
- }
2997
- if (config2.background) {
2998
- process.env[`${prefix}BACKGROUND`] = config2.background;
2999
- }
3000
- if (config2.brand) {
3001
- process.env[`${prefix}BRAND`] = config2.brand;
3002
- }
3003
- if (config2.alternate) {
3004
- process.env[`${prefix}ALTERNATE`] = config2.alternate;
3005
- }
3006
- if (config2.accent) {
3007
- process.env[`${prefix}ACCENT`] = config2.accent;
3008
- }
3009
- if (config2.link) {
3010
- process.env[`${prefix}LINK`] = config2.link;
3011
- }
3012
- if (config2.discovery) {
3013
- process.env[`${prefix}DISCOVERY`] = config2.discovery;
3014
- }
3015
- if (config2.success) {
3016
- process.env[`${prefix}SUCCESS`] = config2.success;
3017
- }
3018
- if (config2.info) {
3019
- process.env[`${prefix}INFO`] = config2.info;
3020
- }
3021
- if (config2.debug) {
3022
- process.env[`${prefix}DEBUG`] = config2.debug;
3023
- }
3024
- if (config2.warning) {
3025
- process.env[`${prefix}WARNING`] = config2.warning;
3026
- }
3027
- if (config2.danger) {
3028
- process.env[`${prefix}DANGER`] = config2.danger;
3029
- }
3030
- if (config2.fatal) {
3031
- process.env[`${prefix}FATAL`] = config2.fatal;
3032
- }
3033
- if (config2.performance) {
3034
- process.env[`${prefix}PERFORMANCE`] = config2.performance;
3035
- }
3036
- if (config2.positive) {
3037
- process.env[`${prefix}POSITIVE`] = config2.positive;
3038
- }
3039
- if (config2.negative) {
3040
- process.env[`${prefix}NEGATIVE`] = config2.negative;
3041
- }
3042
- if (config2.gradient) {
3043
- for (let i = 0; i < config2.gradient.length; i++) {
3044
- process.env[`${prefix}GRADIENT_${i}`] = config2.gradient[i];
3045
- }
3046
- }
3047
- };
3048
- var _static_cache = void 0;
3049
- var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
3050
- let result;
3051
- if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
3052
- let _workspaceRoot = workspaceRoot;
3053
- if (!_workspaceRoot) {
3054
- _workspaceRoot = findWorkspaceRoot();
3055
- }
3056
- const configEnv = getConfigEnv();
3057
- const configFile = await getConfigFile(_workspaceRoot);
3058
- if (!configFile) {
3059
- if (!skipLogs) {
3060
- writeWarning(
3061
- "No Storm Workspace configuration file found in the current repository. Please ensure this is the expected behavior - you can add a `storm-workspace.json` file to the root of your workspace if it is not.\n",
3062
- { logLevel: "all" }
3063
- );
3064
- }
3065
- if (useDefault === false) {
3066
- return void 0;
3067
- }
3068
- }
3069
- const defaultConfig = await getPackageJsonConfig(_workspaceRoot);
3070
- const configInput = defu3(
3071
- configEnv,
3072
- configFile,
3073
- defaultConfig
3074
- );
3075
- if (!configInput.variant) {
3076
- configInput.variant = existsSync$1(joinPaths(_workspaceRoot, "nx.json")) || existsSync$1(joinPaths(_workspaceRoot, ".nx")) || existsSync$1(joinPaths(_workspaceRoot, "lerna.json")) || existsSync$1(joinPaths(_workspaceRoot, "turbo.json")) ? "monorepo" : "minimal";
3077
- }
3078
- try {
3079
- const parseResult = await Promise.resolve(
3080
- workspaceConfigSchema._zod.parse(
3081
- { value: configInput, issues: [] },
3082
- { async: true }
3083
- )
3084
- );
3085
- result = applyDefaultConfig(parseResult.value);
3086
- result.workspaceRoot ??= _workspaceRoot;
3087
- } catch (error) {
3088
- throw new Error(
3089
- `Failed to parse Storm Workspace configuration${error?.message ? `: ${error.message}` : ""}
3090
-
3091
- Please ensure your configuration file is valid JSON and matches the expected schema. The current workspace configuration input is: ${formatLogMessage(
3092
- configInput
3093
- )}`,
3094
- {
3095
- cause: error
3096
- }
3097
- );
3098
- }
3099
- } else {
3100
- result = _static_cache.data;
3101
- }
3102
- _static_cache = {
3103
- timestamp: Date.now(),
3104
- data: result
3105
- };
3106
- return result;
3107
- };
3108
- var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
3109
- const config2 = await createStormWorkspaceConfig(
3110
- void 0,
3111
- void 0,
3112
- workspaceRoot,
3113
- skipLogs,
3114
- true
3115
- );
3116
- setConfigEnv(config2);
3117
- if (!skipLogs && !config2.skipConfigLogging) {
3118
- writeTrace(
3119
- `\u2699\uFE0F Using Storm Workspace configuration:
3120
- ${formatLogMessage(config2)}`,
3121
- config2
3122
- );
3123
- }
3124
- return config2;
3125
- };
3126
-
3127
- // ../config-tools/src/get-config.ts
3128
- function getConfig(workspaceRoot, skipLogs = false) {
3129
- return loadStormWorkspaceConfig(workspaceRoot, skipLogs);
3130
- }
3131
- function getWorkspaceConfig(skipLogs = true, options = {}) {
3132
- let workspaceRoot = options.workspaceRoot;
3133
- if (!workspaceRoot) {
3134
- workspaceRoot = findWorkspaceRoot(options.cwd);
3135
- }
3136
- return getConfig(workspaceRoot, skipLogs);
3137
- }
3138
-
3139
- // src/utilities/title-case.ts
3140
- var ACRONYMS = [
3141
- "3D",
3142
- "4D",
3143
- "5G",
3144
- "6G",
3145
- "7G",
3146
- "8G",
3147
- "ACID",
3148
- "AES",
3149
- "AI",
3150
- "AJAX",
3151
- "API",
3152
- "AR",
3153
- "ASCII",
3154
- "B2B",
3155
- "B2C",
3156
- "BFF",
3157
- "BI",
3158
- "BIOS",
3159
- "BGP",
3160
- "BOM",
3161
- "BYOD",
3162
- "C2C",
3163
- "CAGR",
3164
- "CAPTCHA",
3165
- "CD",
3166
- "CDN",
3167
- "CDP",
3168
- "CI",
3169
- "CI/CD",
3170
- "CIAM",
3171
- "CICD",
3172
- "CLI",
3173
- "CMDB",
3174
- "CORS",
3175
- "CPU",
3176
- "CRUD",
3177
- "CSR",
3178
- "CSS",
3179
- "CX",
3180
- "DAG",
3181
- "DBMS",
3182
- "DDoS",
3183
- "DNS",
3184
- "DNSSEC",
3185
- "DOM",
3186
- "DR",
3187
- "DRM",
3188
- "DWH",
3189
- "E2E",
3190
- "EAI",
3191
- "EKS",
3192
- "EOF",
3193
- "EOD",
3194
- "ETC",
3195
- "ETL",
3196
- "EULA",
3197
- "FIDO",
3198
- "FQDN",
3199
- "FTP",
3200
- "FaaS",
3201
- "GDPR",
3202
- "GCP",
3203
- "GPU",
3204
- "GUID",
3205
- "GUI",
3206
- "GZIP",
3207
- "HCI",
3208
- "HDD",
3209
- "HDFS",
3210
- "HIPAA",
3211
- "HMAC",
3212
- "HOTP",
3213
- "HSM",
3214
- "HTML",
3215
- "HTTP",
3216
- "HTTP/2",
3217
- "HTTP/2.0",
3218
- "HTTP/3",
3219
- "HTTP/3.0",
3220
- "HTTP2",
3221
- "HTTPS",
3222
- "HTTPS/2",
3223
- "HTTPS/3",
3224
- "HTTPS3",
3225
- "IAM",
3226
- "IAMM",
3227
- "IAMT",
3228
- "IaaS",
3229
- "ID",
3230
- "IMAP",
3231
- "IP",
3232
- "IPFS",
3233
- "IoT",
3234
- "JSON",
3235
- "JSONP",
3236
- "JWT",
3237
- "K8s",
3238
- "KMS",
3239
- "KPI",
3240
- "LAN",
3241
- "LHS",
3242
- "LXC",
3243
- "MFA",
3244
- "ML",
3245
- "MLOps",
3246
- "MVC",
3247
- "MVP",
3248
- "NAS",
3249
- "NAT",
3250
- "NDA",
3251
- "NFS",
3252
- "NIST",
3253
- "NLP",
3254
- "NPS",
3255
- "OCR",
3256
- "OEM",
3257
- "OKR",
3258
- "OLAP",
3259
- "OLTP",
3260
- "OOP",
3261
- "ORM",
3262
- "OS",
3263
- "OTP",
3264
- "P2P",
3265
- "PDP",
3266
- "PaaS",
3267
- "PCI",
3268
- "PKI",
3269
- "PP",
3270
- "PWA",
3271
- "PX",
3272
- "QA",
3273
- "RAID",
3274
- "RAM",
3275
- "RDS",
3276
- "REST",
3277
- "RHS",
3278
- "RPC",
3279
- "RPA",
3280
- "RUM",
3281
- "RSS",
3282
- "SAN",
3283
- "SASE",
3284
- "SDLC",
3285
- "SDK",
3286
- "SEO",
3287
- "SFTP",
3288
- "SIEM",
3289
- "SLA",
3290
- "SMB",
3291
- "SMTP",
3292
- "SOAP",
3293
- "SOC",
3294
- "SOA",
3295
- "SPDY",
3296
- "SPF",
3297
- "SQL",
3298
- "SRV",
3299
- "SRE",
3300
- "SSH",
3301
- "SSDL",
3302
- "SSO",
3303
- "SSL",
3304
- "SSR",
3305
- "TDD",
3306
- "TLD",
3307
- "TLS",
3308
- "TLS1.3",
3309
- "TOTP",
3310
- "TRPC",
3311
- "TTL",
3312
- "UDP",
3313
- "UI",
3314
- "UID",
3315
- "URI",
3316
- "URL",
3317
- "UTF",
3318
- "UUID",
3319
- "UX",
3320
- "VM",
3321
- "VLAN",
3322
- "VPN",
3323
- "VR",
3324
- "WAF",
3325
- "WAN",
3326
- "WLAN",
3327
- "WPA",
3328
- "XACML",
3329
- "XML",
3330
- "XSRF",
3331
- "XSS",
3332
- "XR",
3333
- "YAML",
3334
- "ZTA"
3335
- ];
3336
- ACRONYMS.reduce(
3337
- (ret, acronym) => {
3338
- ret[acronym.toLowerCase()] = acronym;
3339
- return ret;
3340
- },
3341
- {
3342
- cspell: "CSpell",
3343
- eslint: "ESLint",
3344
- nx: "Nx"
3345
- }
3346
- );
3347
-
3348
- // src/utilities/changelog-utils.ts
3349
- function generateChangelogTitle(version2, project, workspaceConfig) {
3350
- if (!workspaceConfig?.name || !project) {
3351
- return version2;
3352
- }
3353
- return `[${version2}](https://github.com/${typeof workspaceConfig.organization === "string" ? workspaceConfig.organization : workspaceConfig.organization?.name}/${workspaceConfig.name}/releases/tag/${project}%40${version2}) (${(/* @__PURE__ */ new Date()).getMonth() + 1 < 10 ? `0${(/* @__PURE__ */ new Date()).getMonth() + 1}` : (/* @__PURE__ */ new Date()).getMonth() + 1}/${(/* @__PURE__ */ new Date()).getDate() < 10 ? `0${(/* @__PURE__ */ new Date()).getDate()}` : (/* @__PURE__ */ new Date()).getDate()}/${(/* @__PURE__ */ new Date()).getFullYear()})`;
3354
- }
3355
-
3356
- // src/release/changelog-renderer.ts
3357
- var StormChangelogRenderer = class extends DefaultChangelogRenderer {
3358
- /**
3359
- * The Storm workspace configuration object, which is loaded from the storm-workspace.json file.
3360
- */
3361
- workspaceConfig;
3362
- /**
3363
- * A ChangelogRenderer class takes in the determined changes and other relevant metadata and returns a string, or a Promise of a string of changelog contents (usually markdown).
3364
- *
3365
- * @param config - The configuration object for the ChangelogRenderer
3366
- */
3367
- constructor(config2) {
3368
- const resolvedConfig = {
3369
- entryWhenNoChanges: false,
3370
- conventionalCommitsConfig: DEFAULT_CONVENTIONAL_COMMITS_CONFIG,
3371
- ...config2
3372
- };
3373
- super(resolvedConfig);
3374
- this.workspaceConfig = config2.workspaceConfig;
3375
- this.remoteReleaseClient = resolvedConfig.remoteReleaseClient;
3376
- }
3377
- async render() {
3378
- if (!this.workspaceConfig) {
3379
- this.workspaceConfig = await getWorkspaceConfig();
3380
- }
3381
- return super.render();
3382
- }
3383
- preprocessChanges() {
3384
- this.relevantChanges = [...this.changes];
3385
- this.breakingChanges = [];
3386
- this.additionalChangesForAuthorsSection = [];
3387
- for (let i = this.relevantChanges.length - 1; i >= 0; i--) {
3388
- const change = this.relevantChanges[i];
3389
- if (change && change.type === "revert" && change.revertedHashes) {
3390
- for (const revertedHash of change.revertedHashes) {
3391
- const revertedCommitIndex = this.relevantChanges.findIndex(
3392
- (c) => c.shortHash && revertedHash.startsWith(c.shortHash)
3393
- );
3394
- if (revertedCommitIndex !== -1) {
3395
- this.relevantChanges.splice(revertedCommitIndex, 1);
3396
- this.relevantChanges.splice(i, 1);
3397
- i--;
3398
- break;
3399
- }
3400
- }
3401
- }
3402
- }
3403
- if (this.isVersionPlans) {
3404
- this.conventionalCommitsConfig = {
3405
- useCommitScope: this.workspaceConfig?.variant === "monorepo",
3406
- types: {
3407
- feat: DEFAULT_CONVENTIONAL_COMMITS_CONFIG.types.feat,
3408
- fix: DEFAULT_CONVENTIONAL_COMMITS_CONFIG.types.fix
3409
- }
3410
- };
3411
- for (let i = this.relevantChanges.length - 1; i >= 0; i--) {
3412
- if (this.relevantChanges[i]?.isBreaking) {
3413
- const change = this.relevantChanges[i];
3414
- if (change) {
3415
- this.additionalChangesForAuthorsSection.push(change);
3416
- const line = this.formatChange(change);
3417
- this.breakingChanges.push(line);
3418
- this.relevantChanges.splice(i, 1);
3419
- }
3420
- }
3421
- }
3422
- } else {
3423
- for (const change of this.relevantChanges) {
3424
- if (change.isBreaking) {
3425
- const breakingChangeExplanation = change.body ? this.extractBreakingChangeExplanation(change.body) : "";
3426
- this.breakingChanges.push(
3427
- breakingChangeExplanation ? `- ${change.scope ? `**${change.scope.trim()}:** ` : ""}${breakingChangeExplanation}` : this.formatChange(change)
3428
- );
3429
- }
3430
- }
3431
- }
3432
- }
3433
- /**
3434
- * Determines if the changelog entry should be rendered as empty. This is the case when there are no relevant changes, breaking changes, or dependency bumps.
3435
- */
3436
- // protected override shouldRenderEmptyEntry(): boolean {
3437
- // return true;
3438
- // }
3439
- renderVersionTitle() {
3440
- const isMajorVersion = `${major(this.changelogEntryVersion)}.0.0` === this.changelogEntryVersion.replace(/^v/, "");
3441
- return isMajorVersion ? `# ${generateChangelogTitle(
3442
- this.changelogEntryVersion,
3443
- this.project,
3444
- this.workspaceConfig
3445
- )}` : `## ${generateChangelogTitle(
3446
- this.changelogEntryVersion,
3447
- this.project,
3448
- this.workspaceConfig
3449
- )}`;
3450
- }
3451
- renderBreakingChanges() {
3452
- return [
3453
- "### Breaking Changes",
3454
- "",
3455
- ...Array.from(new Set(this.breakingChanges))
3456
- ];
3457
- }
3458
- renderDependencyBumps() {
3459
- const markdownLines = ["", "### Updated Dependencies", ""];
3460
- this.dependencyBumps?.forEach(({ dependencyName, newVersion }) => {
3461
- const markdownLine = `- Updated **${dependencyName}** to **v${newVersion}**`;
3462
- if (!markdownLines.includes(markdownLine)) {
3463
- markdownLines.push(markdownLine);
3464
- }
3465
- });
3466
- return markdownLines;
3467
- }
3468
- async renderAuthors() {
3469
- const markdownLines = [];
3470
- const _authors = /* @__PURE__ */ new Map();
3471
- for (const change of [
3472
- ...this.relevantChanges,
3473
- ...this.additionalChangesForAuthorsSection
3474
- ]) {
3475
- if (!change.authors) {
3476
- continue;
3477
- }
3478
- for (const author of change.authors) {
3479
- const name = this.formatName(author.name);
3480
- if (!name || name.includes("[bot]") || name === this.workspaceConfig?.bot.name) {
3481
- continue;
3482
- }
3483
- if (_authors.has(name)) {
3484
- const entry = _authors.get(name);
3485
- entry?.email.add(author.email);
3486
- } else {
3487
- _authors.set(name, { email: /* @__PURE__ */ new Set([author.email]) });
3488
- }
3489
- }
3490
- }
3491
- if (this.changelogRenderOptions.mapAuthorsToGitHubUsernames) {
3492
- await Promise.all(
3493
- [..._authors.keys()].map(async (authorName) => {
3494
- const meta2 = _authors.get(authorName);
3495
- if (!meta2) {
3496
- return;
3497
- }
3498
- for (const email2 of meta2.email) {
3499
- if (email2?.endsWith("@users.noreply.github.com")) {
3500
- const match = email2?.match(
3501
- /^(\d+\+)?([^@]+)@users\.noreply\.github\.com$/
3502
- );
3503
- if (match && match[2]) {
3504
- meta2.github = match[2];
3505
- break;
3506
- }
3507
- }
3508
- const { data } = await axios2.get(`https://ungh.cc/users/find/${email2}`).catch(() => ({ data: { user: null } }));
3509
- if (data?.user) {
3510
- meta2.github = data.user.username;
3511
- break;
3512
- }
3513
- }
3514
- })
3515
- );
3516
- }
3517
- const authors = [..._authors.entries()].map((e) => ({
3518
- name: e[0],
3519
- ...e[1]
3520
- }));
3521
- if (authors.length > 0) {
3522
- markdownLines.push(
3523
- "",
3524
- "### \u2764\uFE0F Thank You",
3525
- "",
3526
- ...authors.sort((a, b) => a.name.localeCompare(b.name)).map((i) => {
3527
- const github = i.github ? ` @${i.github}` : "";
3528
- return `- ${i.name}${github}`;
3529
- })
3530
- );
3531
- }
3532
- return markdownLines;
3533
- }
3534
- formatChange(change) {
3535
- let description = change.description || "";
3536
- let extraLines = [];
3537
- let extraLinesStr = "";
3538
- if (description.includes("\n")) {
3539
- const lines = description.split("\n");
3540
- if (lines.length > 1) {
3541
- description = lines[0];
3542
- extraLines = lines.slice(1);
3543
- }
3544
- const indentation = " ";
3545
- extraLinesStr = extraLines.filter((l) => l.trim().length > 0).map((l) => `${indentation}${l}`).join("\n");
3546
- }
3547
- let changeLine = "- " + (!this.isVersionPlans && change.scope ? `**${change.scope.trim()}:** ` : "") + description;
3548
- if (change.githubReferences) {
3549
- changeLine += this.remoteReleaseClient.formatReferences(
3550
- change.githubReferences
3551
- );
3552
- }
3553
- if (extraLinesStr) {
3554
- changeLine += "\n\n" + extraLinesStr;
3555
- }
3556
- return changeLine;
3557
- }
3558
- };
3559
-
3560
- // src/release/config.ts
3561
- var DEFAULT_CONVENTIONAL_COMMITS_CONFIG2 = {
3562
- useCommitScope: true,
3563
- questions: DEFAULT_MONOREPO_COMMIT_QUESTIONS,
3564
- types: DEFAULT_COMMIT_TYPES
3565
- };
3566
- var DEFAULT_INDEPENDENT_RELEASE_TAG_PATTERN = "{projectName}@{version}";
3567
- var DEFAULT_FIXED_RELEASE_TAG_PATTERN = "{releaseGroupName}@{version}";
3568
- var DEFAULT_COMMIT_MESSAGE = "release(monorepo): Publish release updates";
3569
- var DEFAULT_RELEASE_GROUP_GIT_CONFIG = {
3570
- commit: false,
3571
- commitMessage: DEFAULT_COMMIT_MESSAGE,
3572
- commitArgs: "",
3573
- tag: false,
3574
- tagMessage: "",
3575
- tagArgs: "",
3576
- stageChanges: false,
3577
- pushArgs: ""
3578
- };
3579
- var DEFAULT_VERSION_RELEASE_CONFIG = {
3580
- currentVersionResolver: "git-tag",
3581
- fallbackCurrentVersionResolver: "disk",
3582
- specifierSource: "conventional-commits",
3583
- groupPreVersionCommand: "pnpm build",
3584
- preserveLocalDependencyProtocols: true,
3585
- preserveMatchingDependencyRanges: true,
3586
- logUnchangedProjects: true,
3587
- updateDependents: "always",
3588
- git: {
3589
- ...DEFAULT_RELEASE_GROUP_GIT_CONFIG,
3590
- stageChanges: true
3591
- }
3592
- };
3593
- var DEFAULT_CHANGELOG_RELEASE_CONFIG = {
3594
- createRelease: "github",
3595
- renderOptions: {
3596
- authors: false,
3597
- commitReferences: true,
3598
- versionTitleDate: true
3599
- },
3600
- git: {
3601
- ...DEFAULT_RELEASE_GROUP_GIT_CONFIG,
3602
- commit: true,
3603
- tag: true,
3604
- push: true
3605
- }
3606
- };
3607
- var DEFAULT_RELEASE_GROUP_CONFIG = {
3608
- changelog: {
3609
- ...DEFAULT_CHANGELOG_RELEASE_CONFIG
3610
- },
3611
- version: {
3612
- ...DEFAULT_VERSION_RELEASE_CONFIG
3613
- },
3614
- versionPlans: false
3615
- };
3616
- var DEFAULT_INDEPENDENT_RELEASE_GROUP_CONFIG = {
3617
- projectsRelationship: "independent",
3618
- releaseTag: {
3619
- pattern: DEFAULT_INDEPENDENT_RELEASE_TAG_PATTERN
3620
- }
3621
- };
3622
- var DEFAULT_FIXED_RELEASE_GROUP_CONFIG = {
3623
- projectsRelationship: "fixed",
3624
- releaseTag: {
3625
- pattern: DEFAULT_FIXED_RELEASE_TAG_PATTERN
3626
- }
3627
- };
3628
- var DEFAULT_JS_RELEASE_GROUP_CONFIG = {
3629
- version: {
3630
- versionActions: "@storm-software/workspace-tools/release/js-version-actions",
3631
- versionActionsOptions: {
3632
- currentVersionResolver: "git-tag",
3633
- specifierSource: "conventional-commits"
3634
- },
3635
- manifestRootsToUpdate: [
3636
- "{projectRoot}",
3637
- {
3638
- path: "dist/{projectRoot}",
3639
- preserveLocalDependencyProtocols: false
3640
- }
3641
- ]
3642
- }
3643
- };
3644
- var DEFAULT_RUST_RELEASE_GROUP_CONFIG = {
3645
- version: {
3646
- versionActions: "@storm-software/workspace-tools/release/rust-version-actions",
3647
- versionActionsOptions: {
3648
- currentVersionResolver: "git-tag",
3649
- specifierSource: "conventional-commits"
3650
- },
3651
- manifestRootsToUpdate: ["{projectRoot}"]
3652
- }
3653
- };
3654
- var DEFAULT_RELEASE_CONFIG = {
3655
- conventionalCommits: DEFAULT_CONVENTIONAL_COMMITS_CONFIG2,
3656
- groups: {
3657
- packages: defu3(
3658
- {
3659
- projects: ["packages/*"]
3660
- },
3661
- DEFAULT_JS_RELEASE_GROUP_CONFIG,
3662
- DEFAULT_INDEPENDENT_RELEASE_GROUP_CONFIG,
3663
- DEFAULT_RELEASE_GROUP_CONFIG
3664
- ),
3665
- crates: defu3(
3666
- {
3667
- projects: ["crates/*"]
3668
- },
3669
- DEFAULT_RUST_RELEASE_GROUP_CONFIG,
3670
- DEFAULT_INDEPENDENT_RELEASE_GROUP_CONFIG,
3671
- DEFAULT_RELEASE_GROUP_CONFIG
3672
- )
3673
- },
3674
- changelog: {
3675
- ...DEFAULT_CHANGELOG_RELEASE_CONFIG,
3676
- automaticFromRef: true,
3677
- workspaceChangelog: false,
3678
- projectChangelogs: true
3679
- },
3680
- releaseTag: {
3681
- pattern: DEFAULT_INDEPENDENT_RELEASE_TAG_PATTERN
3682
- },
3683
- version: {
3684
- ...DEFAULT_VERSION_RELEASE_CONFIG
3685
- }
3686
- };
3687
- function mergeReleaseGroupConfig(config2, defaultConfig, workspaceConfig) {
3688
- return defu3(
3689
- {
3690
- ...omit(defaultConfig, ["changelog", "version"]),
3691
- ...config2
3692
- },
3693
- {
3694
- version: {
3695
- ...defaultConfig.version
3696
- }
3697
- },
3698
- {
3699
- changelog: {
3700
- ...typeof defaultConfig.changelog === "object" ? defaultConfig.changelog : {},
3701
- renderer: StormChangelogRenderer,
3702
- renderOptions: {
3703
- ...typeof defaultConfig.changelog === "object" && defaultConfig.changelog.renderOptions || {},
3704
- workspaceConfig
3705
- }
3706
- }
3707
- }
3708
- );
3709
- }
3710
- function getReleaseGroupConfig(projectGraph, releaseConfig, workspaceConfig) {
3711
- const alreadyMatchedProjects = /* @__PURE__ */ new Set();
3712
- return !releaseConfig?.groups || Object.keys(releaseConfig.groups).length === 0 ? {} : Object.fromEntries(
3713
- Object.entries(releaseConfig.groups).map(([name, group]) => {
3714
- const matchingProjects = findMatchingProjects(
3715
- typeof group.projects === "string" ? [group.projects] : group.projects,
3716
- projectGraph.nodes
3717
- );
3718
- if (!matchingProjects.length) {
3719
- writeWarning(
3720
- `Release group "${name}" does not have any matching projects.`
3721
- );
3722
- return void 0;
3723
- }
3724
- for (const project of matchingProjects) {
3725
- if (alreadyMatchedProjects.has(project)) {
3726
- throw new Error(
3727
- `Project "${project}" is included in more than one release group. Please ensure that each project is only included in one release group, or remove the "projects" property from the release group configuration to allow it to be included in the same release group as other projects with overlapping globs.`
3728
- );
3729
- }
3730
- alreadyMatchedProjects.add(project);
3731
- }
3732
- let defaultConfig = {};
3733
- if (matchingProjects.every(
3734
- (project) => projectGraph.nodes[project]?.data && (projectGraph.nodes[project]?.data.metadata?.js || isEqualProjectTag(
3735
- projectGraph.nodes[project]?.data,
3736
- ProjectTagConstants.Language.TAG_ID,
3737
- ProjectTagConstants.Language.TYPESCRIPT
3738
- ) || projectGraph.nodes[project]?.data.metadata?.root && existsSync(
3739
- joinPaths(
3740
- projectGraph.nodes[project]?.data.metadata?.root,
3741
- "package.json"
3742
- )
3743
- ))
3744
- )) {
3745
- defaultConfig = defu3(
3746
- group.projectsRelationship === "fixed" ? DEFAULT_FIXED_RELEASE_GROUP_CONFIG : DEFAULT_INDEPENDENT_RELEASE_GROUP_CONFIG,
3747
- DEFAULT_JS_RELEASE_GROUP_CONFIG,
3748
- DEFAULT_RELEASE_GROUP_CONFIG
3749
- );
3750
- } else if (matchingProjects.every(
3751
- (project) => projectGraph.nodes[project]?.data && (projectGraph.nodes[project]?.data.metadata?.rust || projectGraph.nodes[project]?.data.metadata?.cargo || isEqualProjectTag(
3752
- projectGraph.nodes[project]?.data,
3753
- ProjectTagConstants.Language.TAG_ID,
3754
- ProjectTagConstants.Language.RUST
3755
- ) || projectGraph.nodes[project]?.data.metadata?.root && existsSync(
3756
- joinPaths(
3757
- projectGraph.nodes[project]?.data.metadata?.root,
3758
- "Cargo.toml"
3759
- )
3760
- ))
3761
- )) {
3762
- defaultConfig = defu3(
3763
- group.projectsRelationship === "fixed" ? DEFAULT_FIXED_RELEASE_GROUP_CONFIG : DEFAULT_INDEPENDENT_RELEASE_GROUP_CONFIG,
3764
- DEFAULT_RUST_RELEASE_GROUP_CONFIG,
3765
- DEFAULT_RELEASE_GROUP_CONFIG
3766
- );
3767
- }
3768
- const config2 = mergeReleaseGroupConfig(
3769
- group,
3770
- defaultConfig,
3771
- workspaceConfig
3772
- );
3773
- config2.projects = matchingProjects;
3774
- if (workspaceConfig?.workspaceRoot) {
3775
- if (config2.changelog?.renderer && typeof config2.changelog?.renderer === "string" && config2.changelog?.renderer?.toString().startsWith("./")) {
3776
- config2.changelog.renderer = joinPaths(
3777
- workspaceConfig.workspaceRoot,
3778
- config2.changelog.renderer
3779
- );
3780
- }
3781
- if (config2.version?.versionActions && config2.version.versionActions.startsWith("./")) {
3782
- config2.version.versionActions = joinPaths(
3783
- workspaceConfig.workspaceRoot,
3784
- config2.version?.versionActions
3785
- );
3786
- }
3787
- }
3788
- return [name, config2];
3789
- }).filter(Boolean)
3790
- );
3791
- }
3792
- function getReleaseConfig(projectGraph, releaseConfig, workspaceConfig, ignoreNxJsonConfig = false) {
3793
- let nxJson = {};
3794
- if (!ignoreNxJsonConfig && existsSync(joinPaths(workspaceConfig.workspaceRoot, "nx.json"))) {
3795
- nxJson = readNxJson();
3796
- }
3797
- const baseConfig = defu3(
3798
- {
3799
- changelog: {
3800
- renderOptions: {
3801
- workspaceConfig
3802
- }
3803
- },
3804
- groups: {}
3805
- },
3806
- omit(releaseConfig, ["groups"]),
3807
- nxJson.release ? omit(nxJson.release, ["groups"]) : {},
3808
- omit(DEFAULT_RELEASE_CONFIG, ["groups"])
3809
- );
3810
- let groups = {};
3811
- if (releaseConfig?.groups && Object.keys(releaseConfig.groups).length > 0) {
3812
- groups = releaseConfig.groups;
3813
- if (nxJson.release?.groups && Object.keys(nxJson.release.groups).length > 0) {
3814
- groups = defu3(
3815
- groups,
3816
- nxJson.release.groups
3817
- );
3818
- }
3819
- } else if (nxJson.release?.groups && Object.keys(nxJson.release.groups).length > 0) {
3820
- groups = nxJson.release.groups;
3821
- } else {
3822
- groups = DEFAULT_RELEASE_CONFIG.groups;
3823
- }
3824
- return {
3825
- ...baseConfig,
3826
- groups: getReleaseGroupConfig(
3827
- projectGraph,
3828
- { ...baseConfig, groups },
3829
- workspaceConfig
3830
- )
3831
- };
3832
- }
3833
- function formatConfigLog(config2) {
3834
- return formatLogMessage(config2, {
3835
- sort: true,
3836
- skip: ["workspaceConfig", "conventionalCommits"]
3837
- });
3838
- }
3839
-
3840
- export { DEFAULT_CHANGELOG_RELEASE_CONFIG, DEFAULT_COMMIT_MESSAGE, DEFAULT_CONVENTIONAL_COMMITS_CONFIG2 as DEFAULT_CONVENTIONAL_COMMITS_CONFIG, DEFAULT_FIXED_RELEASE_GROUP_CONFIG, DEFAULT_FIXED_RELEASE_TAG_PATTERN, DEFAULT_INDEPENDENT_RELEASE_GROUP_CONFIG, DEFAULT_INDEPENDENT_RELEASE_TAG_PATTERN, DEFAULT_JS_RELEASE_GROUP_CONFIG, DEFAULT_RELEASE_CONFIG, DEFAULT_RELEASE_GROUP_CONFIG, DEFAULT_RELEASE_GROUP_GIT_CONFIG, DEFAULT_RUST_RELEASE_GROUP_CONFIG, DEFAULT_VERSION_RELEASE_CONFIG, formatConfigLog, getReleaseConfig, getReleaseGroupConfig, mergeReleaseGroupConfig };