@storm-software/config-tools 1.173.0 → 1.173.2
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.
- package/README.md +4 -2
- package/bin/config.cjs +4 -2
- package/bin/config.js +4 -2
- package/dist/{chunk-TGDG6POD.cjs → chunk-3FETUQ3K.cjs} +2 -2
- package/dist/{chunk-ROLVAV5Z.cjs → chunk-3SACUIVX.cjs} +8 -8
- package/dist/{chunk-BMDGKEGP.cjs → chunk-4G5FBDI6.cjs} +9 -9
- package/dist/chunk-4PX5UVAN.cjs +65 -0
- package/dist/{chunk-62YJAX4N.js → chunk-6ZPXQNSV.js} +6 -6
- package/dist/{chunk-XT2XO7TR.js → chunk-73L7WNYI.js} +3 -3
- package/dist/{chunk-DX767CQS.cjs → chunk-7STXZ7BN.cjs} +33 -33
- package/dist/{chunk-YTUBIKWS.js → chunk-AFZV7JXZ.js} +4 -4
- package/dist/{chunk-JRKB77S5.js → chunk-AUCRLLQF.js} +1 -1
- package/dist/{chunk-7BVMJTE2.cjs → chunk-BKUK5DV7.cjs} +9 -9
- package/dist/{chunk-WT2BVWII.js → chunk-BTRJGTBW.js} +3 -3
- package/dist/chunk-BZLWPMXE.js +40 -0
- package/dist/chunk-CMR737AZ.js +138 -0
- package/dist/chunk-CQBV3A23.cjs +55 -0
- package/dist/chunk-CS5NQ3OG.cjs +40 -0
- package/dist/{chunk-U74E4EM6.js → chunk-DBAAIFJN.js} +1 -1
- package/dist/{chunk-FO5MOLUY.cjs → chunk-FTTZBFXG.cjs} +20 -20
- package/dist/chunk-HDYKVRNJ.js +40 -0
- package/dist/{chunk-IETV2DPL.js → chunk-HYJVQZYZ.js} +1 -1
- package/dist/{chunk-XPPM3PBH.js → chunk-JB3OUBHN.js} +3 -3
- package/dist/{chunk-OUYYXBZX.js → chunk-JCPJSRHW.js} +10 -10
- package/dist/chunk-JLIGJTMV.js +55 -0
- package/dist/{chunk-T4ZMKMEG.cjs → chunk-JMI7BRL7.cjs} +3 -3
- package/dist/{chunk-4XRV4CVP.js → chunk-K4CDYUQR.js} +1 -1
- package/dist/chunk-KEVN7E43.cjs +138 -0
- package/dist/{chunk-4PAEA5KV.cjs → chunk-KH5SONKW.cjs} +4 -4
- package/dist/{chunk-CPWR3CZZ.cjs → chunk-KYNO2VMS.cjs} +15 -15
- package/dist/{chunk-OJP4XIBV.js → chunk-LM2UMGYA.js} +2 -2
- package/dist/chunk-N5TOHWQY.cjs +92 -0
- package/dist/chunk-P7SO3C2J.js +92 -0
- package/dist/{chunk-VLWSWYG7.js → chunk-PTHGOJU6.js} +2 -2
- package/dist/{chunk-AQ2NOVJF.cjs → chunk-QLJYCKMD.cjs} +2 -2
- package/dist/{chunk-AH2DDCPN.cjs → chunk-S2BDGENQ.cjs} +11 -11
- package/dist/{chunk-XHJCRUWP.js → chunk-SBTNBIMS.js} +2 -2
- package/dist/{chunk-4KZ3BMNG.js → chunk-SHD7ZUSQ.js} +2 -2
- package/dist/chunk-SMVSQFZ3.js +158 -0
- package/dist/chunk-SQTATREP.js +47 -0
- package/dist/chunk-TTH3ECOM.cjs +40 -0
- package/dist/{chunk-AEZINHEA.cjs → chunk-U436743U.cjs} +5 -5
- package/dist/chunk-UBEBZYFH.cjs +40 -0
- package/dist/chunk-VAPTNFV3.cjs +47 -0
- package/dist/chunk-WBQ4VS7E.cjs +23 -0
- package/dist/{chunk-42TCRG4H.js → chunk-WYQYWPLE.js} +1 -1
- package/dist/chunk-XPQXNNGZ.cjs +158 -0
- package/dist/config-file/get-config-file.cjs +21 -21
- package/dist/config-file/get-config-file.js +20 -20
- package/dist/config-file/index.cjs +22 -22
- package/dist/config-file/index.js +21 -21
- package/dist/create-storm-config.cjs +29 -29
- package/dist/create-storm-config.js +23 -23
- package/dist/env/get-env.cjs +5 -5
- package/dist/env/get-env.js +4 -4
- package/dist/env/index.cjs +7 -7
- package/dist/env/index.js +6 -6
- package/dist/env/set-env.cjs +5 -5
- package/dist/env/set-env.js +4 -4
- package/dist/get-config.cjs +25 -25
- package/dist/get-config.js +24 -24
- package/dist/index.cjs +27 -27
- package/dist/index.js +26 -26
- package/dist/logger/chalk.cjs +2 -2
- package/dist/logger/chalk.js +1 -1
- package/dist/logger/console-icons.cjs +4 -4
- package/dist/logger/console-icons.js +3 -3
- package/dist/logger/console.cjs +12 -12
- package/dist/logger/console.js +11 -11
- package/dist/logger/create-logger.cjs +13 -13
- package/dist/logger/create-logger.js +12 -12
- package/dist/logger/format-timestamp.cjs +2 -2
- package/dist/logger/format-timestamp.js +1 -1
- package/dist/logger/get-log-level.cjs +3 -3
- package/dist/logger/get-log-level.js +2 -2
- package/dist/logger/index.cjs +14 -14
- package/dist/logger/index.js +13 -13
- package/dist/logger/is-unicode-supported.cjs +2 -2
- package/dist/logger/is-unicode-supported.js +1 -1
- package/dist/types.cjs +2 -2
- package/dist/types.js +1 -1
- package/dist/utilities/apply-workspace-tokens.cjs +5 -5
- package/dist/utilities/apply-workspace-tokens.js +4 -4
- package/dist/utilities/correct-paths.cjs +2 -2
- package/dist/utilities/correct-paths.js +1 -1
- package/dist/utilities/file-path-utils.cjs +3 -3
- package/dist/utilities/file-path-utils.js +2 -2
- package/dist/utilities/find-up.cjs +2 -2
- package/dist/utilities/find-up.js +1 -1
- package/dist/utilities/find-workspace-root.cjs +4 -4
- package/dist/utilities/find-workspace-root.js +3 -3
- package/dist/utilities/get-default-config.cjs +5 -5
- package/dist/utilities/get-default-config.js +4 -4
- package/dist/utilities/index.cjs +20 -20
- package/dist/utilities/index.js +19 -19
- package/dist/utilities/process-handler.cjs +13 -13
- package/dist/utilities/process-handler.js +12 -12
- package/dist/utilities/run.cjs +2 -2
- package/dist/utilities/run.js +1 -1
- package/dist/utilities/toml.cjs +15 -15
- package/dist/utilities/toml.js +14 -14
- package/package.json +5 -13
- package/dist/chunk-26LV7S6Z.cjs +0 -40
- package/dist/chunk-7BZWQZUV.cjs +0 -65
- package/dist/chunk-PSHJQ2NP.cjs +0 -23
- /package/dist/{chunk-3EVEDCXL.js → chunk-2AVLCXLT.js} +0 -0
- /package/dist/{chunk-6D6DEG6Z.cjs → chunk-65SWKEHV.cjs} +0 -0
- /package/dist/{chunk-RWBPUJIZ.js → chunk-6JBGUE4A.js} +0 -0
- /package/dist/{chunk-64DXC5WM.js → chunk-6RVIJKY3.js} +0 -0
- /package/dist/{chunk-FRR2ZRWD.js → chunk-7IMLZPZF.js} +0 -0
- /package/dist/{chunk-6DTRKFZD.cjs → chunk-7PV6L7I7.cjs} +0 -0
- /package/dist/{chunk-QNDF3RQL.cjs → chunk-BN6MEGGY.cjs} +0 -0
- /package/dist/{chunk-NS5PJ2RM.cjs → chunk-CTYIEJ7C.cjs} +0 -0
- /package/dist/{chunk-XEZGYUS2.js → chunk-CZ4IE2QN.js} +0 -0
- /package/dist/{chunk-ZGLOKOL3.cjs → chunk-DQT6QJRQ.cjs} +0 -0
- /package/dist/{chunk-PLLCZVZO.cjs → chunk-DTGT4OI3.cjs} +0 -0
- /package/dist/{chunk-R6A4VPC4.js → chunk-G2MK47WL.js} +0 -0
- /package/dist/{chunk-C5OTFOQB.cjs → chunk-IRCFHYKZ.cjs} +0 -0
- /package/dist/{chunk-E4R6RI5D.cjs → chunk-IWD6YQKX.cjs} +0 -0
- /package/dist/{chunk-GSK6EGCB.js → chunk-L6UNTUC4.js} +0 -0
- /package/dist/{chunk-4JREL2GQ.cjs → chunk-M3REM2FU.cjs} +0 -0
- /package/dist/{chunk-RKGXITNB.cjs → chunk-N3UX6L7X.cjs} +0 -0
- /package/dist/{chunk-KT6HSF26.cjs → chunk-NAT5PWY2.cjs} +0 -0
- /package/dist/{chunk-T3MUE32G.js → chunk-P2KJ6EZO.js} +0 -0
- /package/dist/{chunk-3QAWRU2B.js → chunk-POXTJ6GF.js} +0 -0
- /package/dist/{chunk-SABD7NYM.js → chunk-RRKB32OH.js} +0 -0
- /package/dist/{chunk-XIA6NF6N.js → chunk-WWUHEYYM.js} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkU436743Ucjs = require('./chunk-U436743U.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkM3REM2FUcjs = require('./chunk-M3REM2FU.cjs');
|
|
7
7
|
|
|
8
8
|
// src/utilities/get-default-config.ts
|
|
9
9
|
|
|
@@ -48,10 +48,10 @@ async function getPackageJsonConfig(root) {
|
|
|
48
48
|
let name = void 0;
|
|
49
49
|
let namespace = void 0;
|
|
50
50
|
let repository = void 0;
|
|
51
|
-
const workspaceRoot =
|
|
51
|
+
const workspaceRoot = _chunkU436743Ucjs.findWorkspaceRoot.call(void 0, root);
|
|
52
52
|
if (_fs.existsSync.call(void 0, _path.join.call(void 0, workspaceRoot, "package.json"))) {
|
|
53
53
|
const file = await _promises.readFile.call(void 0,
|
|
54
|
-
|
|
54
|
+
_chunkM3REM2FUcjs.joinPaths.call(void 0, workspaceRoot, "package.json"),
|
|
55
55
|
"utf8"
|
|
56
56
|
);
|
|
57
57
|
if (file) {
|
|
@@ -1,12 +1,12 @@
|
|
|
1
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
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkM3REM2FUcjs = require('./chunk-M3REM2FU.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunk4PX5UVANcjs = require('./chunk-4PX5UVAN.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var _chunkIRCFHYKZcjs = require('./chunk-IRCFHYKZ.cjs');
|
|
10
10
|
|
|
11
11
|
// src/env/set-env.ts
|
|
12
12
|
var setExtensionEnv = (extensionName, extension) => {
|
|
@@ -117,40 +117,40 @@ var setConfigEnv = (config) => {
|
|
|
117
117
|
process.env.LANG = config.locale ? `${config.locale.replaceAll("-", "_")}.UTF-8` : "en_US.UTF-8";
|
|
118
118
|
}
|
|
119
119
|
if (config.configFile) {
|
|
120
|
-
process.env[`${prefix}CONFIG_FILE`] =
|
|
120
|
+
process.env[`${prefix}CONFIG_FILE`] = _chunkM3REM2FUcjs.correctPaths.call(void 0, config.configFile);
|
|
121
121
|
}
|
|
122
122
|
if (config.workspaceRoot) {
|
|
123
|
-
process.env[`${prefix}WORKSPACE_ROOT`] =
|
|
124
|
-
process.env.NX_WORKSPACE_ROOT =
|
|
125
|
-
process.env.NX_WORKSPACE_ROOT_PATH =
|
|
123
|
+
process.env[`${prefix}WORKSPACE_ROOT`] = _chunkM3REM2FUcjs.correctPaths.call(void 0, config.workspaceRoot);
|
|
124
|
+
process.env.NX_WORKSPACE_ROOT = _chunkM3REM2FUcjs.correctPaths.call(void 0, config.workspaceRoot);
|
|
125
|
+
process.env.NX_WORKSPACE_ROOT_PATH = _chunkM3REM2FUcjs.correctPaths.call(void 0, config.workspaceRoot);
|
|
126
126
|
}
|
|
127
127
|
if (config.directories) {
|
|
128
128
|
if (!config.skipCache && config.directories.cache) {
|
|
129
|
-
process.env[`${prefix}CACHE_DIR`] =
|
|
129
|
+
process.env[`${prefix}CACHE_DIR`] = _chunkM3REM2FUcjs.correctPaths.call(void 0,
|
|
130
130
|
config.directories.cache
|
|
131
131
|
);
|
|
132
132
|
process.env[`${prefix}CACHE_DIRECTORY`] = process.env[`${prefix}CACHE_DIR`];
|
|
133
133
|
}
|
|
134
134
|
if (config.directories.data) {
|
|
135
|
-
process.env[`${prefix}DATA_DIR`] =
|
|
135
|
+
process.env[`${prefix}DATA_DIR`] = _chunkM3REM2FUcjs.correctPaths.call(void 0, config.directories.data);
|
|
136
136
|
process.env[`${prefix}DATA_DIRECTORY`] = process.env[`${prefix}DATA_DIR`];
|
|
137
137
|
}
|
|
138
138
|
if (config.directories.config) {
|
|
139
|
-
process.env[`${prefix}CONFIG_DIR`] =
|
|
139
|
+
process.env[`${prefix}CONFIG_DIR`] = _chunkM3REM2FUcjs.correctPaths.call(void 0,
|
|
140
140
|
config.directories.config
|
|
141
141
|
);
|
|
142
142
|
process.env[`${prefix}CONFIG_DIRECTORY`] = process.env[`${prefix}CONFIG_DIR`];
|
|
143
143
|
}
|
|
144
144
|
if (config.directories.temp) {
|
|
145
|
-
process.env[`${prefix}TEMP_DIR`] =
|
|
145
|
+
process.env[`${prefix}TEMP_DIR`] = _chunkM3REM2FUcjs.correctPaths.call(void 0, config.directories.temp);
|
|
146
146
|
process.env[`${prefix}TEMP_DIRECTORY`] = process.env[`${prefix}TEMP_DIR`];
|
|
147
147
|
}
|
|
148
148
|
if (config.directories.log) {
|
|
149
|
-
process.env[`${prefix}LOG_DIR`] =
|
|
149
|
+
process.env[`${prefix}LOG_DIR`] = _chunkM3REM2FUcjs.correctPaths.call(void 0, config.directories.log);
|
|
150
150
|
process.env[`${prefix}LOG_DIRECTORY`] = process.env[`${prefix}LOG_DIR`];
|
|
151
151
|
}
|
|
152
152
|
if (config.directories.build) {
|
|
153
|
-
process.env[`${prefix}BUILD_DIR`] =
|
|
153
|
+
process.env[`${prefix}BUILD_DIR`] = _chunkM3REM2FUcjs.correctPaths.call(void 0,
|
|
154
154
|
config.directories.build
|
|
155
155
|
);
|
|
156
156
|
process.env[`${prefix}BUILD_DIRECTORY`] = process.env[`${prefix}BUILD_DIR`];
|
|
@@ -217,9 +217,9 @@ var setConfigEnv = (config) => {
|
|
|
217
217
|
process.env[`${prefix}LOG_LEVEL`] = String(config.logLevel);
|
|
218
218
|
process.env.LOG_LEVEL = String(config.logLevel);
|
|
219
219
|
process.env.NX_VERBOSE_LOGGING = String(
|
|
220
|
-
|
|
220
|
+
_chunk4PX5UVANcjs.getLogLevel.call(void 0, config.logLevel) >= _chunkIRCFHYKZcjs.LogLevel.DEBUG ? true : false
|
|
221
221
|
);
|
|
222
|
-
process.env.RUST_BACKTRACE =
|
|
222
|
+
process.env.RUST_BACKTRACE = _chunk4PX5UVANcjs.getLogLevel.call(void 0, config.logLevel) >= _chunkIRCFHYKZcjs.LogLevel.DEBUG ? "full" : "none";
|
|
223
223
|
}
|
|
224
224
|
if (config.skipConfigLogging !== void 0) {
|
|
225
225
|
process.env[`${prefix}SKIP_CONFIG_LOGGING`] = String(
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
isUnicodeSupported
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-G2MK47WL.js";
|
|
4
4
|
import {
|
|
5
5
|
LogLevelLabel
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-POXTJ6GF.js";
|
|
7
7
|
|
|
8
8
|
// src/logger/console-icons.ts
|
|
9
9
|
var useIcon = (c, fallback) => isUnicodeSupported() ? c : fallback;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
|
+
|
|
3
|
+
var _chunkXPQXNNGZcjs = require('./chunk-XPQXNNGZ.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
var _chunkU436743Ucjs = require('./chunk-U436743U.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
var _chunkM3REM2FUcjs = require('./chunk-M3REM2FU.cjs');
|
|
10
|
+
|
|
11
|
+
// src/config-file/get-config-file.ts
|
|
12
|
+
var _c12 = require('c12');
|
|
13
|
+
var _defu = require('defu'); var _defu2 = _interopRequireDefault(_defu);
|
|
14
|
+
var getConfigFileByName = async (fileName, filePath, options = {}) => {
|
|
15
|
+
const workspacePath = filePath || _chunkU436743Ucjs.findWorkspaceRoot.call(void 0, filePath);
|
|
16
|
+
const configs = await Promise.all([
|
|
17
|
+
_c12.loadConfig.call(void 0, {
|
|
18
|
+
cwd: workspacePath,
|
|
19
|
+
packageJson: true,
|
|
20
|
+
name: fileName,
|
|
21
|
+
envName: _optionalChain([fileName, 'optionalAccess', _ => _.toUpperCase, 'call', _2 => _2()]),
|
|
22
|
+
jitiOptions: {
|
|
23
|
+
debug: false,
|
|
24
|
+
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : _chunkM3REM2FUcjs.joinPaths.call(void 0,
|
|
25
|
+
process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
|
|
26
|
+
"jiti"
|
|
27
|
+
)
|
|
28
|
+
},
|
|
29
|
+
...options
|
|
30
|
+
}),
|
|
31
|
+
_c12.loadConfig.call(void 0, {
|
|
32
|
+
cwd: workspacePath,
|
|
33
|
+
packageJson: true,
|
|
34
|
+
name: fileName,
|
|
35
|
+
envName: _optionalChain([fileName, 'optionalAccess', _3 => _3.toUpperCase, 'call', _4 => _4()]),
|
|
36
|
+
jitiOptions: {
|
|
37
|
+
debug: false,
|
|
38
|
+
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : _chunkM3REM2FUcjs.joinPaths.call(void 0,
|
|
39
|
+
process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
|
|
40
|
+
"jiti"
|
|
41
|
+
)
|
|
42
|
+
},
|
|
43
|
+
configFile: fileName,
|
|
44
|
+
...options
|
|
45
|
+
})
|
|
46
|
+
]);
|
|
47
|
+
return _defu2.default.call(void 0, _nullishCoalesce(configs[0], () => ( {})), _nullishCoalesce(configs[1], () => ( {})));
|
|
48
|
+
};
|
|
49
|
+
var getConfigFile = async (filePath, additionalFileNames = []) => {
|
|
50
|
+
const workspacePath = filePath ? filePath : _chunkU436743Ucjs.findWorkspaceRoot.call(void 0, filePath);
|
|
51
|
+
const result = await getConfigFileByName("storm-workspace", workspacePath);
|
|
52
|
+
let config = result.config;
|
|
53
|
+
const configFile = result.configFile;
|
|
54
|
+
if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) {
|
|
55
|
+
_chunkXPQXNNGZcjs.writeTrace.call(void 0,
|
|
56
|
+
`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`,
|
|
57
|
+
{
|
|
58
|
+
logLevel: "all"
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
if (additionalFileNames && additionalFileNames.length > 0) {
|
|
63
|
+
const results = await Promise.all(
|
|
64
|
+
additionalFileNames.map(
|
|
65
|
+
(fileName) => getConfigFileByName(fileName, workspacePath)
|
|
66
|
+
)
|
|
67
|
+
);
|
|
68
|
+
for (const result2 of results) {
|
|
69
|
+
if (_optionalChain([result2, 'optionalAccess', _5 => _5.config]) && _optionalChain([result2, 'optionalAccess', _6 => _6.configFile]) && Object.keys(result2.config).length > 0) {
|
|
70
|
+
if (!config.skipConfigLogging && !result2.config.skipConfigLogging) {
|
|
71
|
+
_chunkXPQXNNGZcjs.writeTrace.call(void 0,
|
|
72
|
+
`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`,
|
|
73
|
+
{
|
|
74
|
+
logLevel: "all"
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
config = _defu2.default.call(void 0, _nullishCoalesce(result2.config, () => ( {})), _nullishCoalesce(config, () => ( {})));
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (!config || Object.keys(config).length === 0) {
|
|
83
|
+
return void 0;
|
|
84
|
+
}
|
|
85
|
+
config.configFile = configFile;
|
|
86
|
+
return config;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
exports.getConfigFileByName = getConfigFileByName; exports.getConfigFile = getConfigFile;
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import {
|
|
2
|
+
writeTrace
|
|
3
|
+
} from "./chunk-JCPJSRHW.js";
|
|
4
|
+
import {
|
|
5
|
+
findWorkspaceRoot
|
|
6
|
+
} from "./chunk-PTHGOJU6.js";
|
|
7
|
+
import {
|
|
8
|
+
joinPaths
|
|
9
|
+
} from "./chunk-7IMLZPZF.js";
|
|
10
|
+
|
|
11
|
+
// src/config-file/get-config-file.ts
|
|
12
|
+
import { loadConfig } from "c12";
|
|
13
|
+
import defu from "defu";
|
|
14
|
+
var getConfigFileByName = async (fileName, filePath, options = {}) => {
|
|
15
|
+
const workspacePath = filePath || findWorkspaceRoot(filePath);
|
|
16
|
+
const configs = await Promise.all([
|
|
17
|
+
loadConfig({
|
|
18
|
+
cwd: workspacePath,
|
|
19
|
+
packageJson: true,
|
|
20
|
+
name: fileName,
|
|
21
|
+
envName: fileName?.toUpperCase(),
|
|
22
|
+
jitiOptions: {
|
|
23
|
+
debug: false,
|
|
24
|
+
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
|
|
25
|
+
process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
|
|
26
|
+
"jiti"
|
|
27
|
+
)
|
|
28
|
+
},
|
|
29
|
+
...options
|
|
30
|
+
}),
|
|
31
|
+
loadConfig({
|
|
32
|
+
cwd: workspacePath,
|
|
33
|
+
packageJson: true,
|
|
34
|
+
name: fileName,
|
|
35
|
+
envName: fileName?.toUpperCase(),
|
|
36
|
+
jitiOptions: {
|
|
37
|
+
debug: false,
|
|
38
|
+
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
|
|
39
|
+
process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
|
|
40
|
+
"jiti"
|
|
41
|
+
)
|
|
42
|
+
},
|
|
43
|
+
configFile: fileName,
|
|
44
|
+
...options
|
|
45
|
+
})
|
|
46
|
+
]);
|
|
47
|
+
return defu(configs[0] ?? {}, configs[1] ?? {});
|
|
48
|
+
};
|
|
49
|
+
var getConfigFile = async (filePath, additionalFileNames = []) => {
|
|
50
|
+
const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
|
|
51
|
+
const result = await getConfigFileByName("storm-workspace", workspacePath);
|
|
52
|
+
let config = result.config;
|
|
53
|
+
const configFile = result.configFile;
|
|
54
|
+
if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) {
|
|
55
|
+
writeTrace(
|
|
56
|
+
`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`,
|
|
57
|
+
{
|
|
58
|
+
logLevel: "all"
|
|
59
|
+
}
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
if (additionalFileNames && additionalFileNames.length > 0) {
|
|
63
|
+
const results = await Promise.all(
|
|
64
|
+
additionalFileNames.map(
|
|
65
|
+
(fileName) => getConfigFileByName(fileName, workspacePath)
|
|
66
|
+
)
|
|
67
|
+
);
|
|
68
|
+
for (const result2 of results) {
|
|
69
|
+
if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
|
|
70
|
+
if (!config.skipConfigLogging && !result2.config.skipConfigLogging) {
|
|
71
|
+
writeTrace(
|
|
72
|
+
`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`,
|
|
73
|
+
{
|
|
74
|
+
logLevel: "all"
|
|
75
|
+
}
|
|
76
|
+
);
|
|
77
|
+
}
|
|
78
|
+
config = defu(result2.config ?? {}, config ?? {});
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (!config || Object.keys(config).length === 0) {
|
|
83
|
+
return void 0;
|
|
84
|
+
}
|
|
85
|
+
config.configFile = configFile;
|
|
86
|
+
return config;
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
export {
|
|
90
|
+
getConfigFileByName,
|
|
91
|
+
getConfigFile
|
|
92
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
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
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkU436743Ucjs = require('./chunk-U436743U.cjs');
|
|
4
4
|
|
|
5
5
|
// src/utilities/apply-workspace-tokens.ts
|
|
6
6
|
var applyWorkspaceBaseTokens = async (option, tokenParams) => {
|
|
@@ -37,7 +37,7 @@ var applyWorkspaceBaseTokens = async (option, tokenParams) => {
|
|
|
37
37
|
if (result.includes("{workspaceRoot}")) {
|
|
38
38
|
result = result.replaceAll(
|
|
39
39
|
"{workspaceRoot}",
|
|
40
|
-
_nullishCoalesce(_nullishCoalesce(tokenParams.workspaceRoot, () => ( _optionalChain([tokenParams, 'access', _2 => _2.config, 'optionalAccess', _3 => _3.workspaceRoot]))), () => (
|
|
40
|
+
_nullishCoalesce(_nullishCoalesce(tokenParams.workspaceRoot, () => ( _optionalChain([tokenParams, 'access', _2 => _2.config, 'optionalAccess', _3 => _3.workspaceRoot]))), () => ( _chunkU436743Ucjs.findWorkspaceRoot.call(void 0, )))
|
|
41
41
|
);
|
|
42
42
|
}
|
|
43
43
|
return result;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkM3REM2FUcjs = require('./chunk-M3REM2FU.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunk4PX5UVANcjs = require('./chunk-4PX5UVAN.cjs');
|
|
7
7
|
|
|
8
8
|
// src/env/get-env.ts
|
|
9
9
|
|
|
@@ -63,15 +63,15 @@ var getConfigEnv = () => {
|
|
|
63
63
|
support: process.env[`${prefix}SUPPORT`] || void 0,
|
|
64
64
|
timezone: process.env[`${prefix}TIMEZONE`] || process.env.TZ || void 0,
|
|
65
65
|
locale: process.env[`${prefix}LOCALE`] || process.env.LOCALE || void 0,
|
|
66
|
-
configFile: process.env[`${prefix}CONFIG_FILE`] ?
|
|
67
|
-
workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`] ?
|
|
66
|
+
configFile: process.env[`${prefix}CONFIG_FILE`] ? _chunkM3REM2FUcjs.correctPaths.call(void 0, process.env[`${prefix}CONFIG_FILE`]) : void 0,
|
|
67
|
+
workspaceRoot: process.env[`${prefix}WORKSPACE_ROOT`] ? _chunkM3REM2FUcjs.correctPaths.call(void 0, process.env[`${prefix}WORKSPACE_ROOT`]) : void 0,
|
|
68
68
|
directories: {
|
|
69
|
-
cache: process.env[`${prefix}CACHE_DIR`] ?
|
|
70
|
-
data: process.env[`${prefix}DATA_DIR`] ?
|
|
71
|
-
config: process.env[`${prefix}CONFIG_DIR`] ?
|
|
72
|
-
temp: process.env[`${prefix}TEMP_DIR`] ?
|
|
73
|
-
log: process.env[`${prefix}LOG_DIR`] ?
|
|
74
|
-
build: process.env[`${prefix}BUILD_DIR`] ?
|
|
69
|
+
cache: process.env[`${prefix}CACHE_DIR`] ? _chunkM3REM2FUcjs.correctPaths.call(void 0, process.env[`${prefix}CACHE_DIR`]) : process.env[`${prefix}CACHE_DIRECTORY`] ? _chunkM3REM2FUcjs.correctPaths.call(void 0, process.env[`${prefix}CACHE_DIRECTORY`]) : void 0,
|
|
70
|
+
data: process.env[`${prefix}DATA_DIR`] ? _chunkM3REM2FUcjs.correctPaths.call(void 0, process.env[`${prefix}DATA_DIR`]) : process.env[`${prefix}DATA_DIRECTORY`] ? _chunkM3REM2FUcjs.correctPaths.call(void 0, process.env[`${prefix}DATA_DIRECTORY`]) : void 0,
|
|
71
|
+
config: process.env[`${prefix}CONFIG_DIR`] ? _chunkM3REM2FUcjs.correctPaths.call(void 0, process.env[`${prefix}CONFIG_DIR`]) : process.env[`${prefix}CONFIG_DIRECTORY`] ? _chunkM3REM2FUcjs.correctPaths.call(void 0, process.env[`${prefix}CONFIG_DIRECTORY`]) : void 0,
|
|
72
|
+
temp: process.env[`${prefix}TEMP_DIR`] ? _chunkM3REM2FUcjs.correctPaths.call(void 0, process.env[`${prefix}TEMP_DIR`]) : process.env[`${prefix}TEMP_DIRECTORY`] ? _chunkM3REM2FUcjs.correctPaths.call(void 0, process.env[`${prefix}TEMP_DIRECTORY`]) : void 0,
|
|
73
|
+
log: process.env[`${prefix}LOG_DIR`] ? _chunkM3REM2FUcjs.correctPaths.call(void 0, process.env[`${prefix}LOG_DIR`]) : process.env[`${prefix}LOG_DIRECTORY`] ? _chunkM3REM2FUcjs.correctPaths.call(void 0, process.env[`${prefix}LOG_DIRECTORY`]) : void 0,
|
|
74
|
+
build: process.env[`${prefix}BUILD_DIR`] ? _chunkM3REM2FUcjs.correctPaths.call(void 0, process.env[`${prefix}BUILD_DIR`]) : process.env[`${prefix}BUILD_DIRECTORY`] ? _chunkM3REM2FUcjs.correctPaths.call(void 0, process.env[`${prefix}BUILD_DIRECTORY`]) : void 0
|
|
75
75
|
},
|
|
76
76
|
skipCache: process.env[`${prefix}SKIP_CACHE`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CACHE`]) : void 0,
|
|
77
77
|
mode: (_nullishCoalesce(_nullishCoalesce(process.env[`${prefix}MODE`], () => ( process.env.NODE_ENV)), () => ( process.env.ENVIRONMENT))) || void 0,
|
|
@@ -96,7 +96,7 @@ var getConfigEnv = () => {
|
|
|
96
96
|
},
|
|
97
97
|
logLevel: process.env[`${prefix}LOG_LEVEL`] !== null && process.env[`${prefix}LOG_LEVEL`] !== void 0 ? process.env[`${prefix}LOG_LEVEL`] && Number.isSafeInteger(
|
|
98
98
|
Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
|
|
99
|
-
) ?
|
|
99
|
+
) ? _chunk4PX5UVANcjs.getLogLevelLabel.call(void 0,
|
|
100
100
|
Number.parseInt(process.env[`${prefix}LOG_LEVEL`])
|
|
101
101
|
) : process.env[`${prefix}LOG_LEVEL`] : void 0,
|
|
102
102
|
skipConfigLogging: process.env[`${prefix}SKIP_CONFIG_LOGGING`] !== void 0 ? Boolean(process.env[`${prefix}SKIP_CONFIG_LOGGING`]) : void 0
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DEFAULT_COLOR_CONFIG
|
|
3
|
+
} from "./chunk-SHD7ZUSQ.js";
|
|
4
|
+
import {
|
|
5
|
+
getChalk
|
|
6
|
+
} from "./chunk-P2KJ6EZO.js";
|
|
7
|
+
import {
|
|
8
|
+
CONSOLE_ICONS
|
|
9
|
+
} from "./chunk-LM2UMGYA.js";
|
|
10
|
+
import {
|
|
11
|
+
formatTimestamp
|
|
12
|
+
} from "./chunk-CZ4IE2QN.js";
|
|
13
|
+
import {
|
|
14
|
+
getLogLevel
|
|
15
|
+
} from "./chunk-K4CDYUQR.js";
|
|
16
|
+
import {
|
|
17
|
+
LogLevel,
|
|
18
|
+
LogLevelLabel
|
|
19
|
+
} from "./chunk-POXTJ6GF.js";
|
|
20
|
+
|
|
21
|
+
// src/logger/console.ts
|
|
22
|
+
var getLogFn = (logLevel = LogLevel.INFO, config = {}, _chalk = getChalk()) => {
|
|
23
|
+
const colors = !config.colors?.dark && !config.colors?.["base"] && !config.colors?.["base"]?.dark ? DEFAULT_COLOR_CONFIG : config.colors?.dark && typeof config.colors.dark === "string" ? config.colors : config.colors?.["base"]?.dark && typeof config.colors["base"].dark === "string" ? config.colors["base"].dark : config.colors?.["base"] ? config.colors?.["base"] : DEFAULT_COLOR_CONFIG;
|
|
24
|
+
const configLogLevel = config.logLevel || process.env.STORM_LOG_LEVEL || LogLevelLabel.INFO;
|
|
25
|
+
if (logLevel > getLogLevel(configLogLevel) || logLevel <= LogLevel.SILENT || getLogLevel(configLogLevel) <= LogLevel.SILENT) {
|
|
26
|
+
return (_) => {
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
if (typeof logLevel === "number" && LogLevel.FATAL >= logLevel) {
|
|
30
|
+
return (message) => {
|
|
31
|
+
console.error(
|
|
32
|
+
`
|
|
33
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.fatal ?? "#7d1a1a")(`[${CONSOLE_ICONS[LogLevelLabel.FATAL]} Fatal] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
34
|
+
`
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
if (typeof logLevel === "number" && LogLevel.ERROR >= logLevel) {
|
|
39
|
+
return (message) => {
|
|
40
|
+
console.error(
|
|
41
|
+
`
|
|
42
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.danger ?? "#f85149")(`[${CONSOLE_ICONS[LogLevelLabel.ERROR]} Error] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
43
|
+
`
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
if (typeof logLevel === "number" && LogLevel.WARN >= logLevel) {
|
|
48
|
+
return (message) => {
|
|
49
|
+
console.warn(
|
|
50
|
+
`
|
|
51
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.warning ?? "#e3b341")(`[${CONSOLE_ICONS[LogLevelLabel.WARN]} Warn] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
52
|
+
`
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
if (typeof logLevel === "number" && LogLevel.SUCCESS >= logLevel) {
|
|
57
|
+
return (message) => {
|
|
58
|
+
console.info(
|
|
59
|
+
`
|
|
60
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.success ?? "#56d364")(`[${CONSOLE_ICONS[LogLevelLabel.SUCCESS]} Success] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
61
|
+
`
|
|
62
|
+
);
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
if (typeof logLevel === "number" && LogLevel.INFO >= logLevel) {
|
|
66
|
+
return (message) => {
|
|
67
|
+
console.info(
|
|
68
|
+
`
|
|
69
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.info ?? "#58a6ff")(`[${CONSOLE_ICONS[LogLevelLabel.INFO]} Info] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
70
|
+
`
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
if (typeof logLevel === "number" && LogLevel.DEBUG >= logLevel) {
|
|
75
|
+
return (message) => {
|
|
76
|
+
console.debug(
|
|
77
|
+
`
|
|
78
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.DEBUG]} Debug] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
79
|
+
`
|
|
80
|
+
);
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
if (typeof logLevel === "number" && LogLevel.TRACE >= logLevel) {
|
|
84
|
+
return (message) => {
|
|
85
|
+
console.debug(
|
|
86
|
+
`
|
|
87
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.TRACE]} Trace] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
88
|
+
`
|
|
89
|
+
);
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
return (message) => {
|
|
93
|
+
console.log(
|
|
94
|
+
`
|
|
95
|
+
${_chalk.gray(formatTimestamp())} ${_chalk.hex(colors.brand ?? "#1fb2a6")(`[${CONSOLE_ICONS[LogLevelLabel.ALL]} System] `)}${_chalk.bold.whiteBright(formatLogMessage(message))}
|
|
96
|
+
`
|
|
97
|
+
);
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
var writeFatal = (message, config) => getLogFn(LogLevel.FATAL, config)(message);
|
|
101
|
+
var writeError = (message, config) => getLogFn(LogLevel.ERROR, config)(message);
|
|
102
|
+
var writeWarning = (message, config) => getLogFn(LogLevel.WARN, config)(message);
|
|
103
|
+
var writeInfo = (message, config) => getLogFn(LogLevel.INFO, config)(message);
|
|
104
|
+
var writeSuccess = (message, config) => getLogFn(LogLevel.SUCCESS, config)(message);
|
|
105
|
+
var writeDebug = (message, config) => getLogFn(LogLevel.DEBUG, config)(message);
|
|
106
|
+
var writeTrace = (message, config) => getLogFn(LogLevel.TRACE, config)(message);
|
|
107
|
+
var writeSystem = (message, config) => getLogFn(LogLevel.ALL, config)(message);
|
|
108
|
+
var getStopwatch = (name) => {
|
|
109
|
+
const start = process.hrtime();
|
|
110
|
+
return () => {
|
|
111
|
+
const end = process.hrtime(start);
|
|
112
|
+
console.info(
|
|
113
|
+
`
|
|
114
|
+
> \u23F1\uFE0F The${name ? ` ${name}` : ""} process took ${Math.round(
|
|
115
|
+
end[0] * 1e3 + end[1] / 1e6
|
|
116
|
+
)}ms to complete
|
|
117
|
+
`
|
|
118
|
+
);
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
var MAX_DEPTH = 4;
|
|
122
|
+
var formatLogMessage = (message, options = {}, depth = 0) => {
|
|
123
|
+
if (depth > MAX_DEPTH) {
|
|
124
|
+
return "<max depth>";
|
|
125
|
+
}
|
|
126
|
+
const prefix = options.prefix ?? "-";
|
|
127
|
+
const skip = options.skip ?? [];
|
|
128
|
+
return typeof message === "undefined" || message === null || !message && typeof message !== "boolean" ? "<none>" : typeof message === "string" ? message : Array.isArray(message) ? `
|
|
129
|
+
${message.map((item, index) => ` ${prefix}> #${index} = ${formatLogMessage(item, { prefix: `${prefix}-`, skip }, depth + 1)}`).join("\n")}` : typeof message === "object" ? `
|
|
130
|
+
${Object.keys(message).filter((key) => !skip.includes(key)).map(
|
|
131
|
+
(key) => ` ${prefix}> ${key} = ${_isFunction(message[key]) ? "<function>" : typeof message[key] === "object" ? formatLogMessage(
|
|
132
|
+
message[key],
|
|
133
|
+
{ prefix: `${prefix}-`, skip },
|
|
134
|
+
depth + 1
|
|
135
|
+
) : message[key]}`
|
|
136
|
+
).join("\n")}` : message;
|
|
137
|
+
};
|
|
138
|
+
var _isFunction = (value) => {
|
|
139
|
+
try {
|
|
140
|
+
return value instanceof Function || typeof value === "function" || !!(value?.constructor && value?.call && value?.apply);
|
|
141
|
+
} catch (e) {
|
|
142
|
+
return false;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
|
|
146
|
+
export {
|
|
147
|
+
getLogFn,
|
|
148
|
+
writeFatal,
|
|
149
|
+
writeError,
|
|
150
|
+
writeWarning,
|
|
151
|
+
writeInfo,
|
|
152
|
+
writeSuccess,
|
|
153
|
+
writeDebug,
|
|
154
|
+
writeTrace,
|
|
155
|
+
writeSystem,
|
|
156
|
+
getStopwatch,
|
|
157
|
+
formatLogMessage
|
|
158
|
+
};
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import {
|
|
2
|
+
writeError
|
|
3
|
+
} from "./chunk-JCPJSRHW.js";
|
|
4
|
+
|
|
5
|
+
// src/utilities/toml.ts
|
|
6
|
+
import TOML from "@ltd/j-toml";
|
|
7
|
+
function parseCargoTomlWithTree(tree, projectRoot, projectName) {
|
|
8
|
+
const cargoTomlString = tree.read(`${projectRoot}/Cargo.toml`)?.toString();
|
|
9
|
+
if (!cargoTomlString) {
|
|
10
|
+
writeError(`Cannot find a Cargo.toml file in the ${projectName}`);
|
|
11
|
+
throw new Error();
|
|
12
|
+
}
|
|
13
|
+
return parseCargoToml(cargoTomlString);
|
|
14
|
+
}
|
|
15
|
+
function parseCargoToml(cargoString) {
|
|
16
|
+
if (!cargoString) {
|
|
17
|
+
throw new Error("Cargo.toml is empty");
|
|
18
|
+
}
|
|
19
|
+
return TOML.parse(cargoString, {
|
|
20
|
+
x: { comment: true }
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function stringifyCargoToml(cargoToml) {
|
|
24
|
+
const tomlString = TOML.stringify(cargoToml, {
|
|
25
|
+
newlineAround: "section"
|
|
26
|
+
});
|
|
27
|
+
if (Array.isArray(tomlString)) {
|
|
28
|
+
return tomlString.join("\n");
|
|
29
|
+
}
|
|
30
|
+
return tomlString;
|
|
31
|
+
}
|
|
32
|
+
function modifyCargoTable(toml, section, key, value) {
|
|
33
|
+
toml[section] ??= TOML.Section({});
|
|
34
|
+
toml[section][key] = typeof value === "object" && !Array.isArray(value) ? TOML.inline(value) : typeof value === "function" ? value() : value;
|
|
35
|
+
}
|
|
36
|
+
function modifyCargoNestedTable(toml, section, key, value) {
|
|
37
|
+
toml[section] ??= {};
|
|
38
|
+
toml[section][key] = TOML.Section(value);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export {
|
|
42
|
+
parseCargoTomlWithTree,
|
|
43
|
+
parseCargoToml,
|
|
44
|
+
stringifyCargoToml,
|
|
45
|
+
modifyCargoTable,
|
|
46
|
+
modifyCargoNestedTable
|
|
47
|
+
};
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
var _chunkFTTZBFXGcjs = require('./chunk-FTTZBFXG.cjs');
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkU436743Ucjs = require('./chunk-U436743U.cjs');
|
|
8
|
+
|
|
9
|
+
// src/get-config.ts
|
|
10
|
+
var getConfig = (workspaceRoot, skipLogs = false) => {
|
|
11
|
+
return _chunkFTTZBFXGcjs.loadStormWorkspaceConfig.call(void 0, workspaceRoot, skipLogs);
|
|
12
|
+
};
|
|
13
|
+
var getWorkspaceConfig = (skipLogs = true, options = {}) => {
|
|
14
|
+
let workspaceRoot = options.workspaceRoot;
|
|
15
|
+
if (!workspaceRoot) {
|
|
16
|
+
workspaceRoot = _chunkU436743Ucjs.findWorkspaceRoot.call(void 0, options.cwd);
|
|
17
|
+
}
|
|
18
|
+
return getConfig(workspaceRoot, skipLogs);
|
|
19
|
+
};
|
|
20
|
+
var tryGetWorkspaceConfig = async (skipLogs = true, options = {}) => {
|
|
21
|
+
try {
|
|
22
|
+
let workspaceRoot = options.workspaceRoot;
|
|
23
|
+
if (!workspaceRoot) {
|
|
24
|
+
workspaceRoot = _chunkU436743Ucjs.findWorkspaceRoot.call(void 0, options.cwd);
|
|
25
|
+
}
|
|
26
|
+
return _chunkFTTZBFXGcjs.tryLoadStormWorkspaceConfig.call(void 0,
|
|
27
|
+
workspaceRoot,
|
|
28
|
+
skipLogs,
|
|
29
|
+
options.useDefault
|
|
30
|
+
);
|
|
31
|
+
} catch (e) {
|
|
32
|
+
return void 0;
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
|
|
40
|
+
exports.getConfig = getConfig; exports.getWorkspaceConfig = getWorkspaceConfig; exports.tryGetWorkspaceConfig = tryGetWorkspaceConfig;
|