@storm-software/config-tools 1.190.60 → 1.190.61

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.
@@ -1,35 +0,0 @@
1
- import {
2
- getLogFn,
3
- getStopwatch
4
- } from "./chunk-EN32U2DR.js";
5
- import {
6
- LogLevel
7
- } from "./chunk-RALMUN5C.js";
8
-
9
- // src/logger/create-logger.ts
10
- import chalk from "chalk";
11
- async function createLogger(config) {
12
- const writeFatal = getLogFn(LogLevel.FATAL, config, { chalk });
13
- const writeError = getLogFn(LogLevel.ERROR, config, { chalk });
14
- const writeWarning = getLogFn(LogLevel.WARN, config, { chalk });
15
- const writeInfo = getLogFn(LogLevel.INFO, config, { chalk });
16
- const writeSuccess = getLogFn(LogLevel.SUCCESS, config, { chalk });
17
- const writeDebug = getLogFn(LogLevel.DEBUG, config, { chalk });
18
- const writePerformance = getLogFn(LogLevel.PERFORMANCE, config, { chalk });
19
- const writeTrace = getLogFn(LogLevel.TRACE, config, { chalk });
20
- return {
21
- fatal: writeFatal,
22
- error: writeError,
23
- warning: writeWarning,
24
- info: writeInfo,
25
- success: writeSuccess,
26
- performance: writePerformance,
27
- debug: writeDebug,
28
- trace: writeTrace,
29
- getStopwatch
30
- };
31
- }
32
-
33
- export {
34
- createLogger
35
- };
@@ -1,47 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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 _chunkAE67VUIVcjs = require('./chunk-AE67VUIV.cjs');
4
-
5
- // src/utilities/toml.ts
6
- var _jtoml = require('@ltd/j-toml'); var _jtoml2 = _interopRequireDefault(_jtoml);
7
- function parseCargoTomlWithTree(tree, projectRoot, projectName) {
8
- const cargoTomlString = _optionalChain([tree, 'access', _ => _.read, 'call', _2 => _2(`${projectRoot}/Cargo.toml`), 'optionalAccess', _3 => _3.toString, 'call', _4 => _4()]);
9
- if (!cargoTomlString) {
10
- _chunkAE67VUIVcjs.writeError.call(void 0, `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 _jtoml2.default.parse(cargoString, {
20
- x: { comment: true }
21
- });
22
- }
23
- function stringifyCargoToml(cargoToml) {
24
- const tomlString = _jtoml2.default.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] ??= _jtoml2.default.Section({});
34
- toml[section][key] = typeof value === "object" && !Array.isArray(value) ? _jtoml2.default.inline(value) : typeof value === "function" ? value() : value;
35
- }
36
- function modifyCargoNestedTable(toml, section, key, value) {
37
- toml[section] ??= {};
38
- toml[section][key] = _jtoml2.default.Section(value);
39
- }
40
-
41
-
42
-
43
-
44
-
45
-
46
-
47
- exports.parseCargoTomlWithTree = parseCargoTomlWithTree; exports.parseCargoToml = parseCargoToml; exports.stringifyCargoToml = stringifyCargoToml; exports.modifyCargoTable = modifyCargoTable; exports.modifyCargoNestedTable = modifyCargoNestedTable;
@@ -1,165 +0,0 @@
1
- import {
2
- setConfigEnv
3
- } from "./chunk-SDSQ2HHF.js";
4
- import {
5
- getConfigEnv,
6
- getExtensionEnv
7
- } from "./chunk-A5JXMY6X.js";
8
- import {
9
- getConfigFile
10
- } from "./chunk-7UEOVCKZ.js";
11
- import {
12
- applyDefaultConfig,
13
- getPackageJsonConfig
14
- } from "./chunk-RGET2UQV.js";
15
- import {
16
- findWorkspaceRoot
17
- } from "./chunk-LF3SAK2O.js";
18
- import {
19
- formatLogMessage,
20
- writeTrace,
21
- writeWarning
22
- } from "./chunk-EN32U2DR.js";
23
- import {
24
- joinPaths
25
- } from "./chunk-V3GMJ4TX.js";
26
-
27
- // src/create-storm-config.ts
28
- import { workspaceConfigSchema } from "@storm-software/config/schema";
29
- import defu from "defu";
30
- import { existsSync } from "node:fs";
31
- var _extension_cache = /* @__PURE__ */ new WeakMap();
32
- var _static_cache = void 0;
33
- var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
34
- let result;
35
- if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
36
- let _workspaceRoot = workspaceRoot;
37
- if (!_workspaceRoot) {
38
- _workspaceRoot = findWorkspaceRoot();
39
- }
40
- const configEnv = getConfigEnv();
41
- const configFile = await getConfigFile(_workspaceRoot);
42
- if (!configFile) {
43
- if (!skipLogs) {
44
- writeWarning(
45
- "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",
46
- { logLevel: "all" }
47
- );
48
- }
49
- if (useDefault === false) {
50
- return void 0;
51
- }
52
- }
53
- const defaultConfig = await getPackageJsonConfig(_workspaceRoot);
54
- const configInput = defu(
55
- configEnv,
56
- configFile,
57
- defaultConfig
58
- );
59
- if (!configInput.variant) {
60
- configInput.variant = existsSync(joinPaths(_workspaceRoot, "nx.json")) || existsSync(joinPaths(_workspaceRoot, ".nx")) || existsSync(joinPaths(_workspaceRoot, "lerna.json")) || existsSync(joinPaths(_workspaceRoot, "turbo.json")) ? "monorepo" : "minimal";
61
- }
62
- try {
63
- const parseResult = await Promise.resolve(
64
- workspaceConfigSchema._zod.parse(
65
- { value: configInput, issues: [] },
66
- { async: true }
67
- )
68
- );
69
- result = applyDefaultConfig(parseResult.value);
70
- result.workspaceRoot ??= _workspaceRoot;
71
- } catch (error) {
72
- throw new Error(
73
- `Failed to parse Storm Workspace configuration${error?.message ? `: ${error.message}` : ""}
74
-
75
- Please ensure your configuration file is valid JSON and matches the expected schema. The current workspace configuration input is: ${formatLogMessage(
76
- configInput
77
- )}`,
78
- {
79
- cause: error
80
- }
81
- );
82
- }
83
- } else {
84
- result = _static_cache.data;
85
- }
86
- if (schema && extensionName) {
87
- result.extensions = {
88
- ...result.extensions,
89
- [extensionName]: createConfigExtension(extensionName, schema)
90
- };
91
- }
92
- _static_cache = {
93
- timestamp: Date.now(),
94
- data: result
95
- };
96
- return result;
97
- };
98
- var createConfigExtension = (extensionName, schema) => {
99
- const extension_cache_key = { extensionName };
100
- if (_extension_cache.has(extension_cache_key)) {
101
- return _extension_cache.get(extension_cache_key);
102
- }
103
- let extension = getExtensionEnv(extensionName);
104
- if (schema) {
105
- extension = schema.parse(extension);
106
- }
107
- _extension_cache.set(extension_cache_key, extension);
108
- return extension;
109
- };
110
- var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
111
- const config = await createStormWorkspaceConfig(
112
- void 0,
113
- void 0,
114
- workspaceRoot,
115
- skipLogs,
116
- true
117
- );
118
- setConfigEnv(config);
119
- if (!skipLogs && !config.skipConfigLogging) {
120
- writeTrace(
121
- `\u2699\uFE0F Using Storm Workspace configuration:
122
- ${formatLogMessage(config)}`,
123
- config
124
- );
125
- }
126
- return config;
127
- };
128
- var tryLoadStormWorkspaceConfig = async (workspaceRoot, skipLogs = true, useDefault = false) => {
129
- try {
130
- const config = await createStormWorkspaceConfig(
131
- void 0,
132
- void 0,
133
- workspaceRoot,
134
- skipLogs,
135
- useDefault
136
- );
137
- if (!config) {
138
- return void 0;
139
- }
140
- setConfigEnv(config);
141
- if (!skipLogs && !config.skipConfigLogging) {
142
- writeTrace(
143
- `\u2699\uFE0F Using Storm Workspace configuration:
144
- ${formatLogMessage(config)}`,
145
- config
146
- );
147
- }
148
- return config;
149
- } catch (error) {
150
- if (!skipLogs) {
151
- writeWarning(
152
- `\u26A0\uFE0F Failed to load Storm Workspace configuration: ${error}`,
153
- { logLevel: "all" }
154
- );
155
- }
156
- return void 0;
157
- }
158
- };
159
-
160
- export {
161
- createStormWorkspaceConfig,
162
- createConfigExtension,
163
- loadStormWorkspaceConfig,
164
- tryLoadStormWorkspaceConfig
165
- };
@@ -1,55 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
-
5
-
6
- var _chunkAE67VUIVcjs = require('./chunk-AE67VUIV.cjs');
7
-
8
- // src/utilities/process-handler.ts
9
- var exitWithError = (config) => {
10
- _chunkAE67VUIVcjs.writeFatal.call(void 0, "Exiting script with an error status...", config);
11
- process.exit(1);
12
- };
13
- var exitWithSuccess = (config) => {
14
- _chunkAE67VUIVcjs.writeSuccess.call(void 0, "Script completed successfully. Exiting...", config);
15
- process.exit(0);
16
- };
17
- var handleProcess = (config) => {
18
- _chunkAE67VUIVcjs.writeTrace.call(void 0,
19
- `Using the following arguments to process the script: ${process.argv.join(", ")}`,
20
- config
21
- );
22
- process.on("unhandledRejection", (error) => {
23
- _chunkAE67VUIVcjs.writeError.call(void 0,
24
- `An Unhandled Rejection occurred while running the program: ${error}`,
25
- config
26
- );
27
- exitWithError(config);
28
- });
29
- process.on("uncaughtException", (error) => {
30
- _chunkAE67VUIVcjs.writeError.call(void 0,
31
- `An Uncaught Exception occurred while running the program: ${error.message}
32
- Stacktrace: ${error.stack}`,
33
- config
34
- );
35
- exitWithError(config);
36
- });
37
- process.on("SIGTERM", (signal) => {
38
- _chunkAE67VUIVcjs.writeError.call(void 0, `The program terminated with signal code: ${signal}`, config);
39
- exitWithError(config);
40
- });
41
- process.on("SIGINT", (signal) => {
42
- _chunkAE67VUIVcjs.writeError.call(void 0, `The program terminated with signal code: ${signal}`, config);
43
- exitWithError(config);
44
- });
45
- process.on("SIGHUP", (signal) => {
46
- _chunkAE67VUIVcjs.writeError.call(void 0, `The program terminated with signal code: ${signal}`, config);
47
- exitWithError(config);
48
- });
49
- };
50
-
51
-
52
-
53
-
54
-
55
- exports.exitWithError = exitWithError; exports.exitWithSuccess = exitWithSuccess; exports.handleProcess = handleProcess;
@@ -1,55 +0,0 @@
1
- import {
2
- writeError,
3
- writeFatal,
4
- writeSuccess,
5
- writeTrace
6
- } from "./chunk-EN32U2DR.js";
7
-
8
- // src/utilities/process-handler.ts
9
- var exitWithError = (config) => {
10
- writeFatal("Exiting script with an error status...", config);
11
- process.exit(1);
12
- };
13
- var exitWithSuccess = (config) => {
14
- writeSuccess("Script completed successfully. Exiting...", config);
15
- process.exit(0);
16
- };
17
- var handleProcess = (config) => {
18
- writeTrace(
19
- `Using the following arguments to process the script: ${process.argv.join(", ")}`,
20
- config
21
- );
22
- process.on("unhandledRejection", (error) => {
23
- writeError(
24
- `An Unhandled Rejection occurred while running the program: ${error}`,
25
- config
26
- );
27
- exitWithError(config);
28
- });
29
- process.on("uncaughtException", (error) => {
30
- writeError(
31
- `An Uncaught Exception occurred while running the program: ${error.message}
32
- Stacktrace: ${error.stack}`,
33
- config
34
- );
35
- exitWithError(config);
36
- });
37
- process.on("SIGTERM", (signal) => {
38
- writeError(`The program terminated with signal code: ${signal}`, config);
39
- exitWithError(config);
40
- });
41
- process.on("SIGINT", (signal) => {
42
- writeError(`The program terminated with signal code: ${signal}`, config);
43
- exitWithError(config);
44
- });
45
- process.on("SIGHUP", (signal) => {
46
- writeError(`The program terminated with signal code: ${signal}`, config);
47
- exitWithError(config);
48
- });
49
- };
50
-
51
- export {
52
- exitWithError,
53
- exitWithSuccess,
54
- handleProcess
55
- };
@@ -1,40 +0,0 @@
1
- import {
2
- loadStormWorkspaceConfig,
3
- tryLoadStormWorkspaceConfig
4
- } from "./chunk-IASBTY6Z.js";
5
- import {
6
- findWorkspaceRoot
7
- } from "./chunk-LF3SAK2O.js";
8
-
9
- // src/get-config.ts
10
- function getConfig(workspaceRoot, skipLogs = false) {
11
- return loadStormWorkspaceConfig(workspaceRoot, skipLogs);
12
- }
13
- function getWorkspaceConfig(skipLogs = true, options = {}) {
14
- let workspaceRoot = options.workspaceRoot;
15
- if (!workspaceRoot) {
16
- workspaceRoot = findWorkspaceRoot(options.cwd);
17
- }
18
- return getConfig(workspaceRoot, skipLogs);
19
- }
20
- async function tryGetWorkspaceConfig(skipLogs = true, options = {}) {
21
- try {
22
- let workspaceRoot = options.workspaceRoot;
23
- if (!workspaceRoot) {
24
- workspaceRoot = findWorkspaceRoot(options.cwd);
25
- }
26
- return tryLoadStormWorkspaceConfig(
27
- workspaceRoot,
28
- skipLogs,
29
- options.useDefault
30
- );
31
- } catch {
32
- return void 0;
33
- }
34
- }
35
-
36
- export {
37
- getConfig,
38
- getWorkspaceConfig,
39
- tryGetWorkspaceConfig
40
- };
@@ -1,165 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 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 _chunkB2CQPVVLcjs = require('./chunk-B2CQPVVL.cjs');
4
-
5
-
6
-
7
- var _chunkNHILCONIcjs = require('./chunk-NHILCONI.cjs');
8
-
9
-
10
- var _chunk552GCC6Pcjs = require('./chunk-552GCC6P.cjs');
11
-
12
-
13
-
14
- var _chunkCFXT4ZAWcjs = require('./chunk-CFXT4ZAW.cjs');
15
-
16
-
17
- var _chunk3CNCDDWZcjs = require('./chunk-3CNCDDWZ.cjs');
18
-
19
-
20
-
21
-
22
- var _chunkAE67VUIVcjs = require('./chunk-AE67VUIV.cjs');
23
-
24
-
25
- var _chunkBDATZ3UBcjs = require('./chunk-BDATZ3UB.cjs');
26
-
27
- // src/create-storm-config.ts
28
- var _schema = require('@storm-software/config/schema');
29
- var _defu = require('defu'); var _defu2 = _interopRequireDefault(_defu);
30
- var _fs = require('fs');
31
- var _extension_cache = /* @__PURE__ */ new WeakMap();
32
- var _static_cache = void 0;
33
- var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
34
- let result;
35
- if (!_optionalChain([_static_cache, 'optionalAccess', _ => _.data]) || !_optionalChain([_static_cache, 'optionalAccess', _2 => _2.timestamp]) || _static_cache.timestamp < Date.now() - 8e3) {
36
- let _workspaceRoot = workspaceRoot;
37
- if (!_workspaceRoot) {
38
- _workspaceRoot = _chunk3CNCDDWZcjs.findWorkspaceRoot.call(void 0, );
39
- }
40
- const configEnv = _chunkNHILCONIcjs.getConfigEnv.call(void 0, );
41
- const configFile = await _chunk552GCC6Pcjs.getConfigFile.call(void 0, _workspaceRoot);
42
- if (!configFile) {
43
- if (!skipLogs) {
44
- _chunkAE67VUIVcjs.writeWarning.call(void 0,
45
- "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",
46
- { logLevel: "all" }
47
- );
48
- }
49
- if (useDefault === false) {
50
- return void 0;
51
- }
52
- }
53
- const defaultConfig = await _chunkCFXT4ZAWcjs.getPackageJsonConfig.call(void 0, _workspaceRoot);
54
- const configInput = _defu2.default.call(void 0,
55
- configEnv,
56
- configFile,
57
- defaultConfig
58
- );
59
- if (!configInput.variant) {
60
- configInput.variant = _fs.existsSync.call(void 0, _chunkBDATZ3UBcjs.joinPaths.call(void 0, _workspaceRoot, "nx.json")) || _fs.existsSync.call(void 0, _chunkBDATZ3UBcjs.joinPaths.call(void 0, _workspaceRoot, ".nx")) || _fs.existsSync.call(void 0, _chunkBDATZ3UBcjs.joinPaths.call(void 0, _workspaceRoot, "lerna.json")) || _fs.existsSync.call(void 0, _chunkBDATZ3UBcjs.joinPaths.call(void 0, _workspaceRoot, "turbo.json")) ? "monorepo" : "minimal";
61
- }
62
- try {
63
- const parseResult = await Promise.resolve(
64
- _schema.workspaceConfigSchema._zod.parse(
65
- { value: configInput, issues: [] },
66
- { async: true }
67
- )
68
- );
69
- result = _chunkCFXT4ZAWcjs.applyDefaultConfig.call(void 0, parseResult.value);
70
- result.workspaceRoot ??= _workspaceRoot;
71
- } catch (error) {
72
- throw new Error(
73
- `Failed to parse Storm Workspace configuration${_optionalChain([error, 'optionalAccess', _3 => _3.message]) ? `: ${error.message}` : ""}
74
-
75
- Please ensure your configuration file is valid JSON and matches the expected schema. The current workspace configuration input is: ${_chunkAE67VUIVcjs.formatLogMessage.call(void 0,
76
- configInput
77
- )}`,
78
- {
79
- cause: error
80
- }
81
- );
82
- }
83
- } else {
84
- result = _static_cache.data;
85
- }
86
- if (schema && extensionName) {
87
- result.extensions = {
88
- ...result.extensions,
89
- [extensionName]: createConfigExtension(extensionName, schema)
90
- };
91
- }
92
- _static_cache = {
93
- timestamp: Date.now(),
94
- data: result
95
- };
96
- return result;
97
- };
98
- var createConfigExtension = (extensionName, schema) => {
99
- const extension_cache_key = { extensionName };
100
- if (_extension_cache.has(extension_cache_key)) {
101
- return _extension_cache.get(extension_cache_key);
102
- }
103
- let extension = _chunkNHILCONIcjs.getExtensionEnv.call(void 0, extensionName);
104
- if (schema) {
105
- extension = schema.parse(extension);
106
- }
107
- _extension_cache.set(extension_cache_key, extension);
108
- return extension;
109
- };
110
- var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
111
- const config = await createStormWorkspaceConfig(
112
- void 0,
113
- void 0,
114
- workspaceRoot,
115
- skipLogs,
116
- true
117
- );
118
- _chunkB2CQPVVLcjs.setConfigEnv.call(void 0, config);
119
- if (!skipLogs && !config.skipConfigLogging) {
120
- _chunkAE67VUIVcjs.writeTrace.call(void 0,
121
- `\u2699\uFE0F Using Storm Workspace configuration:
122
- ${_chunkAE67VUIVcjs.formatLogMessage.call(void 0, config)}`,
123
- config
124
- );
125
- }
126
- return config;
127
- };
128
- var tryLoadStormWorkspaceConfig = async (workspaceRoot, skipLogs = true, useDefault = false) => {
129
- try {
130
- const config = await createStormWorkspaceConfig(
131
- void 0,
132
- void 0,
133
- workspaceRoot,
134
- skipLogs,
135
- useDefault
136
- );
137
- if (!config) {
138
- return void 0;
139
- }
140
- _chunkB2CQPVVLcjs.setConfigEnv.call(void 0, config);
141
- if (!skipLogs && !config.skipConfigLogging) {
142
- _chunkAE67VUIVcjs.writeTrace.call(void 0,
143
- `\u2699\uFE0F Using Storm Workspace configuration:
144
- ${_chunkAE67VUIVcjs.formatLogMessage.call(void 0, config)}`,
145
- config
146
- );
147
- }
148
- return config;
149
- } catch (error) {
150
- if (!skipLogs) {
151
- _chunkAE67VUIVcjs.writeWarning.call(void 0,
152
- `\u26A0\uFE0F Failed to load Storm Workspace configuration: ${error}`,
153
- { logLevel: "all" }
154
- );
155
- }
156
- return void 0;
157
- }
158
- };
159
-
160
-
161
-
162
-
163
-
164
-
165
- exports.createStormWorkspaceConfig = createStormWorkspaceConfig; exports.createConfigExtension = createConfigExtension; exports.loadStormWorkspaceConfig = loadStormWorkspaceConfig; exports.tryLoadStormWorkspaceConfig = tryLoadStormWorkspaceConfig;
@@ -1,47 +0,0 @@
1
- import {
2
- writeError
3
- } from "./chunk-EN32U2DR.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
- };
@@ -1,40 +0,0 @@
1
- "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
-
3
-
4
- var _chunkPWW56TRRcjs = require('./chunk-PWW56TRR.cjs');
5
-
6
-
7
- var _chunk3CNCDDWZcjs = require('./chunk-3CNCDDWZ.cjs');
8
-
9
- // src/get-config.ts
10
- function getConfig(workspaceRoot, skipLogs = false) {
11
- return _chunkPWW56TRRcjs.loadStormWorkspaceConfig.call(void 0, workspaceRoot, skipLogs);
12
- }
13
- function getWorkspaceConfig(skipLogs = true, options = {}) {
14
- let workspaceRoot = options.workspaceRoot;
15
- if (!workspaceRoot) {
16
- workspaceRoot = _chunk3CNCDDWZcjs.findWorkspaceRoot.call(void 0, options.cwd);
17
- }
18
- return getConfig(workspaceRoot, skipLogs);
19
- }
20
- async function tryGetWorkspaceConfig(skipLogs = true, options = {}) {
21
- try {
22
- let workspaceRoot = options.workspaceRoot;
23
- if (!workspaceRoot) {
24
- workspaceRoot = _chunk3CNCDDWZcjs.findWorkspaceRoot.call(void 0, options.cwd);
25
- }
26
- return _chunkPWW56TRRcjs.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;