@storm-software/config-tools 1.176.13 → 1.176.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,81 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
+
3
+ var _chunkZAEOJ4NDcjs = require('./chunk-ZAEOJ4ND.cjs');
4
+
5
+ // src/utilities/apply-workspace-tokens.ts
6
+ var applyWorkspaceBaseTokens = async (option, tokenParams) => {
7
+ let result = option;
8
+ if (!result) {
9
+ return result;
10
+ }
11
+ if (tokenParams) {
12
+ const optionKeys = Object.keys(tokenParams);
13
+ if (optionKeys.some((optionKey) => result.includes(`{${optionKey}}`))) {
14
+ for (const optionKey of optionKeys) {
15
+ if (result.includes(`{${optionKey}}`)) {
16
+ result = result.replaceAll(
17
+ `{${optionKey}}`,
18
+ _optionalChain([tokenParams, 'optionalAccess', _ => _[optionKey]]) || ""
19
+ );
20
+ }
21
+ }
22
+ }
23
+ }
24
+ if (tokenParams.config) {
25
+ const configKeys = Object.keys(tokenParams.config);
26
+ if (configKeys.some((configKey) => result.includes(`{${configKey}}`))) {
27
+ for (const configKey of configKeys) {
28
+ if (result.includes(`{${configKey}}`)) {
29
+ result = result.replaceAll(
30
+ `{${configKey}}`,
31
+ tokenParams.config[configKey] || ""
32
+ );
33
+ }
34
+ }
35
+ }
36
+ }
37
+ if (result.includes("{workspaceRoot}")) {
38
+ result = result.replaceAll(
39
+ "{workspaceRoot}",
40
+ _nullishCoalesce(_nullishCoalesce(tokenParams.workspaceRoot, () => ( _optionalChain([tokenParams, 'access', _2 => _2.config, 'optionalAccess', _3 => _3.workspaceRoot]))), () => ( _chunkZAEOJ4NDcjs.findWorkspaceRoot.call(void 0, )))
41
+ );
42
+ }
43
+ return result;
44
+ };
45
+ var applyWorkspaceProjectTokens = (option, tokenParams) => {
46
+ return applyWorkspaceBaseTokens(option, tokenParams);
47
+ };
48
+ var applyWorkspaceTokens = async (options, tokenParams, tokenizerFn) => {
49
+ if (!options) {
50
+ return {};
51
+ }
52
+ const result = {};
53
+ for (const option of Object.keys(options)) {
54
+ if (typeof options[option] === "string") {
55
+ result[option] = await Promise.resolve(
56
+ tokenizerFn(options[option], tokenParams)
57
+ );
58
+ } else if (Array.isArray(options[option])) {
59
+ result[option] = await Promise.all(
60
+ options[option].map(
61
+ async (item) => typeof item === "string" ? await Promise.resolve(tokenizerFn(item, tokenParams)) : item
62
+ )
63
+ );
64
+ } else if (typeof options[option] === "object") {
65
+ result[option] = await applyWorkspaceTokens(
66
+ options[option],
67
+ tokenParams,
68
+ tokenizerFn
69
+ );
70
+ } else {
71
+ result[option] = options[option];
72
+ }
73
+ }
74
+ return result;
75
+ };
76
+
77
+
78
+
79
+
80
+
81
+ exports.applyWorkspaceBaseTokens = applyWorkspaceBaseTokens; exports.applyWorkspaceProjectTokens = applyWorkspaceProjectTokens; exports.applyWorkspaceTokens = applyWorkspaceTokens;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storm-software/config-tools",
3
- "version": "1.176.13",
3
+ "version": "1.176.15",
4
4
  "type": "module",
5
5
  "description": "A package containing various utilities to support custom workspace configurations and environment management for Storm Software projects, including configuration file handling, environment variable management, and logging utilities.",
6
6
  "repository": {
@@ -211,7 +211,7 @@
211
211
  ],
212
212
  "dependencies": {
213
213
  "@ltd/j-toml": "1.38.0",
214
- "@storm-software/config": "^1.125.12",
214
+ "@storm-software/config": "^1.125.14",
215
215
  "c12": "^2.0.0-beta.2",
216
216
  "chalk": "^4.1.2",
217
217
  "commander": "^12.1.0",
@@ -224,5 +224,5 @@
224
224
  "devDependencies": { "@types/node": "^22.10.2", "tsup": "8.4.0" },
225
225
  "publishConfig": { "access": "public" },
226
226
  "sideEffects": false,
227
- "gitHead": "15cfb513f5ab6c76341888e008ba62b88bcd05af"
227
+ "gitHead": "9ea2d39bba2e80aceb5dde576b5568de39a86ac9"
228
228
  }