🎩 You're Invited:Meet the Socket team at Black Hat in Las Vegas, August 3-6.RSVP
Sign In

@storm-software/config-tools

Package Overview
Dependencies
Maintainers
2
Versions
955
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@storm-software/config-tools - npm Package Compare versions

Comparing version
1.190.98
to
1.190.99
+81
dist/chunk-24B36RDB.cjs
"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; }
var _chunkIWQRXQ4Ncjs = require('./chunk-IWQRXQ4N.cjs');
// src/utilities/apply-workspace-tokens.ts
var applyWorkspaceBaseTokens = async (option, tokenParams) => {
let result = option;
if (!result) {
return result;
}
if (tokenParams) {
const optionKeys = Object.keys(tokenParams);
if (optionKeys.some((optionKey) => result.includes(`{${optionKey}}`))) {
for (const optionKey of optionKeys) {
if (result.includes(`{${optionKey}}`)) {
result = result.replaceAll(
`{${optionKey}}`,
_optionalChain([tokenParams, 'optionalAccess', _ => _[optionKey]]) || ""
);
}
}
}
}
if (tokenParams.config) {
const configKeys = Object.keys(tokenParams.config);
if (configKeys.some((configKey) => result.includes(`{${configKey}}`))) {
for (const configKey of configKeys) {
if (result.includes(`{${configKey}}`)) {
result = result.replaceAll(
`{${configKey}}`,
tokenParams.config[configKey] || ""
);
}
}
}
}
if (result.includes("{workspaceRoot}")) {
result = result.replaceAll(
"{workspaceRoot}",
_nullishCoalesce(_nullishCoalesce(tokenParams.workspaceRoot, () => ( _optionalChain([tokenParams, 'access', _2 => _2.config, 'optionalAccess', _3 => _3.workspaceRoot]))), () => ( _chunkIWQRXQ4Ncjs.findWorkspaceRoot.call(void 0, )))
);
}
return result;
};
var applyWorkspaceProjectTokens = (option, tokenParams) => {
return applyWorkspaceBaseTokens(option, tokenParams);
};
var applyWorkspaceTokens = async (options, tokenParams, tokenizerFn) => {
if (!options) {
return {};
}
const result = {};
for (const option of Object.keys(options)) {
if (typeof options[option] === "string") {
result[option] = await Promise.resolve(
tokenizerFn(options[option], tokenParams)
);
} else if (Array.isArray(options[option])) {
result[option] = await Promise.all(
options[option].map(
async (item) => typeof item === "string" ? await Promise.resolve(tokenizerFn(item, tokenParams)) : item
)
);
} else if (typeof options[option] === "object") {
result[option] = await applyWorkspaceTokens(
options[option],
tokenParams,
tokenizerFn
);
} else {
result[option] = options[option];
}
}
return result;
};
exports.applyWorkspaceBaseTokens = applyWorkspaceBaseTokens; exports.applyWorkspaceProjectTokens = applyWorkspaceProjectTokens; exports.applyWorkspaceTokens = applyWorkspaceTokens;
import {
loadStormWorkspaceConfig,
tryLoadStormWorkspaceConfig
} from "./chunk-4Q45WJYQ.js";
import {
findWorkspaceRoot
} from "./chunk-SO3FWVXC.js";
// src/get-config.ts
function getConfig(workspaceRoot, skipLogs = false) {
return loadStormWorkspaceConfig(workspaceRoot, skipLogs);
}
function getWorkspaceConfig(skipLogs = true, options = {}) {
let workspaceRoot = options.workspaceRoot;
if (!workspaceRoot) {
workspaceRoot = findWorkspaceRoot(options.cwd);
}
return getConfig(workspaceRoot, skipLogs);
}
async function tryGetWorkspaceConfig(skipLogs = true, options = {}) {
try {
let workspaceRoot = options.workspaceRoot;
if (!workspaceRoot) {
workspaceRoot = findWorkspaceRoot(options.cwd);
}
return tryLoadStormWorkspaceConfig(
workspaceRoot,
skipLogs,
options.useDefault
);
} catch {
return void 0;
}
}
export {
getConfig,
getWorkspaceConfig,
tryGetWorkspaceConfig
};
import {
getConfigFile
} from "./chunk-5C7PIENF.js";
import {
applyDefaultConfig,
getPackageJsonConfig
} from "./chunk-MQG74XF7.js";
import {
findWorkspaceRoot
} from "./chunk-SO3FWVXC.js";
import {
formatLogMessage,
writeTrace,
writeWarning
} from "./chunk-D3FRXXDE.js";
import {
setConfigEnv
} from "./chunk-FJNXECWU.js";
import {
getConfigEnv,
getExtensionEnv
} from "./chunk-2RLMTBVZ.js";
import {
joinPaths
} from "./chunk-V3GMJ4TX.js";
// src/create-storm-config.ts
import { workspaceConfigSchema } from "@storm-software/config/schema";
import defu from "defu";
import { existsSync } from "node:fs";
var _extension_cache = /* @__PURE__ */ new WeakMap();
var _static_cache = void 0;
var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
let result;
if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
let _workspaceRoot = workspaceRoot;
if (!_workspaceRoot) {
_workspaceRoot = findWorkspaceRoot();
}
const configEnv = getConfigEnv();
const configFile = await getConfigFile(_workspaceRoot);
if (!configFile) {
if (!skipLogs) {
writeWarning(
"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",
{ logLevel: "all" }
);
}
if (useDefault === false) {
return void 0;
}
}
const defaultConfig = await getPackageJsonConfig(_workspaceRoot);
const configInput = defu(
configEnv,
configFile,
defaultConfig
);
if (!configInput.variant) {
configInput.variant = existsSync(joinPaths(_workspaceRoot, "nx.json")) || existsSync(joinPaths(_workspaceRoot, ".nx")) || existsSync(joinPaths(_workspaceRoot, "lerna.json")) || existsSync(joinPaths(_workspaceRoot, "turbo.json")) ? "monorepo" : "minimal";
}
try {
const parseResult = await Promise.resolve(
workspaceConfigSchema._zod.parse(
{ value: configInput, issues: [] },
{ async: true }
)
);
result = applyDefaultConfig(parseResult.value);
result.workspaceRoot ??= _workspaceRoot;
} catch (error) {
throw new Error(
`Failed to parse Storm Workspace configuration${error?.message ? `: ${error.message}` : ""}
Please ensure your configuration file is valid JSON and matches the expected schema. The current workspace configuration input is: ${formatLogMessage(
configInput
)}`,
{
cause: error
}
);
}
} else {
result = _static_cache.data;
}
if (schema && extensionName) {
result.extensions = {
...result.extensions,
[extensionName]: createConfigExtension(extensionName, schema)
};
}
_static_cache = {
timestamp: Date.now(),
data: result
};
return result;
};
var createConfigExtension = (extensionName, schema) => {
const extension_cache_key = { extensionName };
if (_extension_cache.has(extension_cache_key)) {
return _extension_cache.get(extension_cache_key);
}
let extension = getExtensionEnv(extensionName);
if (schema) {
extension = schema.parse(extension);
}
_extension_cache.set(extension_cache_key, extension);
return extension;
};
var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
const config = await createStormWorkspaceConfig(
void 0,
void 0,
workspaceRoot,
skipLogs,
true
);
setConfigEnv(config);
if (!skipLogs && !config.skipConfigLogging) {
writeTrace(
`\u2699\uFE0F Using Storm Workspace configuration:
${formatLogMessage(config)}`,
config
);
}
return config;
};
var tryLoadStormWorkspaceConfig = async (workspaceRoot, skipLogs = true, useDefault = false) => {
try {
const config = await createStormWorkspaceConfig(
void 0,
void 0,
workspaceRoot,
skipLogs,
useDefault
);
if (!config) {
return void 0;
}
setConfigEnv(config);
if (!skipLogs && !config.skipConfigLogging) {
writeTrace(
`\u2699\uFE0F Using Storm Workspace configuration:
${formatLogMessage(config)}`,
config
);
}
return config;
} catch (error) {
if (!skipLogs) {
writeWarning(
`\u26A0\uFE0F Failed to load Storm Workspace configuration: ${error}`,
{ logLevel: "all" }
);
}
return void 0;
}
};
export {
createStormWorkspaceConfig,
createConfigExtension,
loadStormWorkspaceConfig,
tryLoadStormWorkspaceConfig
};
import {
findWorkspaceRoot
} from "./chunk-SO3FWVXC.js";
import {
writeTrace
} from "./chunk-D3FRXXDE.js";
import {
joinPaths
} from "./chunk-V3GMJ4TX.js";
// src/config-file/get-config-file.ts
import { loadConfig } from "c12";
import defu from "defu";
var getConfigFileByName = async (fileName, filePath, options = {}) => {
const workspacePath = filePath || findWorkspaceRoot(filePath);
const configs = await Promise.all([
loadConfig({
cwd: workspacePath,
packageJson: true,
name: fileName,
envName: fileName?.toUpperCase(),
jitiOptions: {
debug: false,
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
"jiti"
)
},
...options
}),
loadConfig({
cwd: workspacePath,
packageJson: true,
name: fileName,
envName: fileName?.toUpperCase(),
jitiOptions: {
debug: false,
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
"jiti"
)
},
configFile: fileName,
...options
})
]);
return defu(configs[0] ?? {}, configs[1] ?? {});
};
var getConfigFile = async (filePath, additionalFileNames = []) => {
const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
const result = await getConfigFileByName("storm-workspace", workspacePath);
let config = result.config;
const configFile = result.configFile;
if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) {
writeTrace(
`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`,
{
logLevel: "all"
}
);
}
if (additionalFileNames && additionalFileNames.length > 0) {
const results = await Promise.all(
additionalFileNames.map(
(fileName) => getConfigFileByName(fileName, workspacePath)
)
);
for (const result2 of results) {
if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
if (!config.skipConfigLogging && !result2.config.skipConfigLogging) {
writeTrace(
`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`,
{
logLevel: "all"
}
);
}
config = defu(result2.config ?? {}, config ?? {});
}
}
}
if (!config || Object.keys(config).length === 0) {
return void 0;
}
config.configFile = configFile;
return config;
};
export {
getConfigFileByName,
getConfigFile
};
import {
findWorkspaceRoot
} from "./chunk-SO3FWVXC.js";
// src/utilities/apply-workspace-tokens.ts
var applyWorkspaceBaseTokens = async (option, tokenParams) => {
let result = option;
if (!result) {
return result;
}
if (tokenParams) {
const optionKeys = Object.keys(tokenParams);
if (optionKeys.some((optionKey) => result.includes(`{${optionKey}}`))) {
for (const optionKey of optionKeys) {
if (result.includes(`{${optionKey}}`)) {
result = result.replaceAll(
`{${optionKey}}`,
tokenParams?.[optionKey] || ""
);
}
}
}
}
if (tokenParams.config) {
const configKeys = Object.keys(tokenParams.config);
if (configKeys.some((configKey) => result.includes(`{${configKey}}`))) {
for (const configKey of configKeys) {
if (result.includes(`{${configKey}}`)) {
result = result.replaceAll(
`{${configKey}}`,
tokenParams.config[configKey] || ""
);
}
}
}
}
if (result.includes("{workspaceRoot}")) {
result = result.replaceAll(
"{workspaceRoot}",
tokenParams.workspaceRoot ?? tokenParams.config?.workspaceRoot ?? findWorkspaceRoot()
);
}
return result;
};
var applyWorkspaceProjectTokens = (option, tokenParams) => {
return applyWorkspaceBaseTokens(option, tokenParams);
};
var applyWorkspaceTokens = async (options, tokenParams, tokenizerFn) => {
if (!options) {
return {};
}
const result = {};
for (const option of Object.keys(options)) {
if (typeof options[option] === "string") {
result[option] = await Promise.resolve(
tokenizerFn(options[option], tokenParams)
);
} else if (Array.isArray(options[option])) {
result[option] = await Promise.all(
options[option].map(
async (item) => typeof item === "string" ? await Promise.resolve(tokenizerFn(item, tokenParams)) : item
)
);
} else if (typeof options[option] === "object") {
result[option] = await applyWorkspaceTokens(
options[option],
tokenParams,
tokenizerFn
);
} else {
result[option] = options[option];
}
}
return result;
};
export {
applyWorkspaceBaseTokens,
applyWorkspaceProjectTokens,
applyWorkspaceTokens
};
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
var _chunkNJFLUTGHcjs = require('./chunk-NJFLUTGH.cjs');
var _chunkBDATZ3UBcjs = require('./chunk-BDATZ3UB.cjs');
// src/utilities/find-workspace-root.ts
var rootFiles = [
"storm-workspace.json",
"storm-workspace.yaml",
"storm-workspace.yml",
"storm-workspace.js",
"storm-workspace.ts",
".storm-workspace.json",
".storm-workspace.yaml",
".storm-workspace.yml",
".storm-workspace.js",
".storm-workspace.ts",
"lerna.json",
"nx.json",
"turbo.json",
"npm-workspace.json",
"yarn-workspace.json",
"pnpm-workspace.json",
"npm-workspace.yaml",
"yarn-workspace.yaml",
"pnpm-workspace.yaml",
"npm-workspace.yml",
"yarn-workspace.yml",
"pnpm-workspace.yml",
"npm-lock.json",
"yarn-lock.json",
"pnpm-lock.json",
"npm-lock.yaml",
"yarn-lock.yaml",
"pnpm-lock.yaml",
"npm-lock.yml",
"yarn-lock.yml",
"pnpm-lock.yml",
"bun.lockb",
"bun.lock",
"bunfig.toml"
];
var rootDirectories = [
".storm-workspace",
".nx",
".git",
".github",
".vscode",
".verdaccio"
];
function findWorkspaceRootSafe(pathInsideMonorepo) {
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
return _chunkBDATZ3UBcjs.correctPaths.call(void 0,
_nullishCoalesce(process.env.STORM_WORKSPACE_ROOT, () => ( process.env.NX_WORKSPACE_ROOT_PATH))
);
}
return _chunkBDATZ3UBcjs.correctPaths.call(void 0,
_chunkNJFLUTGHcjs.findFolderUp.call(void 0,
_nullishCoalesce(pathInsideMonorepo, () => ( process.cwd())),
rootFiles,
rootDirectories
)
);
}
function findWorkspaceRoot(pathInsideMonorepo) {
const result = findWorkspaceRootSafe(pathInsideMonorepo);
if (!result) {
throw new Error(
`Cannot find workspace root upwards from known path. Files search list includes:
${rootFiles.join(
"\n"
)}
Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
);
}
return result;
}
exports.findWorkspaceRootSafe = findWorkspaceRootSafe; exports.findWorkspaceRoot = findWorkspaceRoot;
import {
findWorkspaceRoot
} from "./chunk-SO3FWVXC.js";
import {
joinPaths
} from "./chunk-V3GMJ4TX.js";
// src/utilities/get-default-config.ts
import {
STORM_DEFAULT_ERROR_CODES_FILE,
STORM_DEFAULT_LICENSE
} from "@storm-software/config";
import { existsSync } from "node:fs";
import { readFile } from "node:fs/promises";
import { join } from "node:path";
async function getPackageJsonConfig(root) {
let license = STORM_DEFAULT_LICENSE;
let homepage = void 0;
let support = void 0;
let name = void 0;
let namespace = void 0;
let repository = void 0;
const workspaceRoot = findWorkspaceRoot(root);
if (existsSync(join(workspaceRoot, "package.json"))) {
const file = await readFile(
joinPaths(workspaceRoot, "package.json"),
"utf8"
);
if (file) {
const packageJson = JSON.parse(file);
if (packageJson.name) {
name = packageJson.name;
}
if (packageJson.namespace) {
namespace = packageJson.namespace;
}
if (packageJson.repository) {
if (typeof packageJson.repository === "string") {
repository = packageJson.repository;
} else if (packageJson.repository.url) {
repository = packageJson.repository.url;
}
}
if (packageJson.license) {
license = packageJson.license;
}
if (packageJson.homepage) {
homepage = packageJson.homepage;
}
if (packageJson.bugs) {
if (typeof packageJson.bugs === "string") {
support = packageJson.bugs;
} else if (packageJson.bugs.url) {
support = packageJson.bugs.url;
}
}
}
}
return {
workspaceRoot,
name,
namespace,
repository,
license,
homepage,
support
};
}
function applyDefaultConfig(config) {
if (!config.support && config.contact) {
config.support = config.contact;
}
if (!config.contact && config.support) {
config.contact = config.support;
}
if (config.homepage) {
if (!config.docs) {
config.docs = `${config.homepage}/docs`;
}
if (!config.license) {
config.license = `${config.homepage}/license`;
}
if (!config.support) {
config.support = `${config.homepage}/support`;
}
if (!config.contact) {
config.contact = `${config.homepage}/contact`;
}
if (!config.error?.codesFile || !config?.error?.url) {
config.error ??= { codesFile: STORM_DEFAULT_ERROR_CODES_FILE };
if (config.homepage) {
config.error.url ??= `${config.homepage}/errors`;
}
}
}
return config;
}
export {
getPackageJsonConfig,
applyDefaultConfig
};
"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; }
var _chunkIWQRXQ4Ncjs = require('./chunk-IWQRXQ4N.cjs');
var _chunkTZZRLM5Jcjs = require('./chunk-TZZRLM5J.cjs');
var _chunkBDATZ3UBcjs = require('./chunk-BDATZ3UB.cjs');
// src/config-file/get-config-file.ts
var _c12 = require('c12');
var _defu = require('defu'); var _defu2 = _interopRequireDefault(_defu);
var getConfigFileByName = async (fileName, filePath, options = {}) => {
const workspacePath = filePath || _chunkIWQRXQ4Ncjs.findWorkspaceRoot.call(void 0, filePath);
const configs = await Promise.all([
_c12.loadConfig.call(void 0, {
cwd: workspacePath,
packageJson: true,
name: fileName,
envName: _optionalChain([fileName, 'optionalAccess', _ => _.toUpperCase, 'call', _2 => _2()]),
jitiOptions: {
debug: false,
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : _chunkBDATZ3UBcjs.joinPaths.call(void 0,
process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
"jiti"
)
},
...options
}),
_c12.loadConfig.call(void 0, {
cwd: workspacePath,
packageJson: true,
name: fileName,
envName: _optionalChain([fileName, 'optionalAccess', _3 => _3.toUpperCase, 'call', _4 => _4()]),
jitiOptions: {
debug: false,
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : _chunkBDATZ3UBcjs.joinPaths.call(void 0,
process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
"jiti"
)
},
configFile: fileName,
...options
})
]);
return _defu2.default.call(void 0, _nullishCoalesce(configs[0], () => ( {})), _nullishCoalesce(configs[1], () => ( {})));
};
var getConfigFile = async (filePath, additionalFileNames = []) => {
const workspacePath = filePath ? filePath : _chunkIWQRXQ4Ncjs.findWorkspaceRoot.call(void 0, filePath);
const result = await getConfigFileByName("storm-workspace", workspacePath);
let config = result.config;
const configFile = result.configFile;
if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) {
_chunkTZZRLM5Jcjs.writeTrace.call(void 0,
`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`,
{
logLevel: "all"
}
);
}
if (additionalFileNames && additionalFileNames.length > 0) {
const results = await Promise.all(
additionalFileNames.map(
(fileName) => getConfigFileByName(fileName, workspacePath)
)
);
for (const result2 of results) {
if (_optionalChain([result2, 'optionalAccess', _5 => _5.config]) && _optionalChain([result2, 'optionalAccess', _6 => _6.configFile]) && Object.keys(result2.config).length > 0) {
if (!config.skipConfigLogging && !result2.config.skipConfigLogging) {
_chunkTZZRLM5Jcjs.writeTrace.call(void 0,
`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`,
{
logLevel: "all"
}
);
}
config = _defu2.default.call(void 0, _nullishCoalesce(result2.config, () => ( {})), _nullishCoalesce(config, () => ( {})));
}
}
}
if (!config || Object.keys(config).length === 0) {
return void 0;
}
config.configFile = configFile;
return config;
};
exports.getConfigFileByName = getConfigFileByName; exports.getConfigFile = getConfigFile;
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkSLICWTO2cjs = require('./chunk-SLICWTO2.cjs');
var _chunkIWQRXQ4Ncjs = require('./chunk-IWQRXQ4N.cjs');
// src/get-config.ts
function getConfig(workspaceRoot, skipLogs = false) {
return _chunkSLICWTO2cjs.loadStormWorkspaceConfig.call(void 0, workspaceRoot, skipLogs);
}
function getWorkspaceConfig(skipLogs = true, options = {}) {
let workspaceRoot = options.workspaceRoot;
if (!workspaceRoot) {
workspaceRoot = _chunkIWQRXQ4Ncjs.findWorkspaceRoot.call(void 0, options.cwd);
}
return getConfig(workspaceRoot, skipLogs);
}
async function tryGetWorkspaceConfig(skipLogs = true, options = {}) {
try {
let workspaceRoot = options.workspaceRoot;
if (!workspaceRoot) {
workspaceRoot = _chunkIWQRXQ4Ncjs.findWorkspaceRoot.call(void 0, options.cwd);
}
return _chunkSLICWTO2cjs.tryLoadStormWorkspaceConfig.call(void 0,
workspaceRoot,
skipLogs,
options.useDefault
);
} catch (e) {
return void 0;
}
}
exports.getConfig = getConfig; exports.getWorkspaceConfig = getWorkspaceConfig; exports.tryGetWorkspaceConfig = tryGetWorkspaceConfig;
"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; }
var _chunkMSAQEGBKcjs = require('./chunk-MSAQEGBK.cjs');
var _chunkT7YISGRScjs = require('./chunk-T7YISGRS.cjs');
var _chunkIWQRXQ4Ncjs = require('./chunk-IWQRXQ4N.cjs');
var _chunkTZZRLM5Jcjs = require('./chunk-TZZRLM5J.cjs');
var _chunkBZRTSWH4cjs = require('./chunk-BZRTSWH4.cjs');
var _chunkUJ77IBHDcjs = require('./chunk-UJ77IBHD.cjs');
var _chunkBDATZ3UBcjs = require('./chunk-BDATZ3UB.cjs');
// src/create-storm-config.ts
var _schema = require('@storm-software/config/schema');
var _defu = require('defu'); var _defu2 = _interopRequireDefault(_defu);
var _fs = require('fs');
var _extension_cache = /* @__PURE__ */ new WeakMap();
var _static_cache = void 0;
var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
let result;
if (!_optionalChain([_static_cache, 'optionalAccess', _ => _.data]) || !_optionalChain([_static_cache, 'optionalAccess', _2 => _2.timestamp]) || _static_cache.timestamp < Date.now() - 8e3) {
let _workspaceRoot = workspaceRoot;
if (!_workspaceRoot) {
_workspaceRoot = _chunkIWQRXQ4Ncjs.findWorkspaceRoot.call(void 0, );
}
const configEnv = _chunkUJ77IBHDcjs.getConfigEnv.call(void 0, );
const configFile = await _chunkMSAQEGBKcjs.getConfigFile.call(void 0, _workspaceRoot);
if (!configFile) {
if (!skipLogs) {
_chunkTZZRLM5Jcjs.writeWarning.call(void 0,
"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",
{ logLevel: "all" }
);
}
if (useDefault === false) {
return void 0;
}
}
const defaultConfig = await _chunkT7YISGRScjs.getPackageJsonConfig.call(void 0, _workspaceRoot);
const configInput = _defu2.default.call(void 0,
configEnv,
configFile,
defaultConfig
);
if (!configInput.variant) {
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";
}
try {
const parseResult = await Promise.resolve(
_schema.workspaceConfigSchema._zod.parse(
{ value: configInput, issues: [] },
{ async: true }
)
);
result = _chunkT7YISGRScjs.applyDefaultConfig.call(void 0, parseResult.value);
result.workspaceRoot ??= _workspaceRoot;
} catch (error) {
throw new Error(
`Failed to parse Storm Workspace configuration${_optionalChain([error, 'optionalAccess', _3 => _3.message]) ? `: ${error.message}` : ""}
Please ensure your configuration file is valid JSON and matches the expected schema. The current workspace configuration input is: ${_chunkTZZRLM5Jcjs.formatLogMessage.call(void 0,
configInput
)}`,
{
cause: error
}
);
}
} else {
result = _static_cache.data;
}
if (schema && extensionName) {
result.extensions = {
...result.extensions,
[extensionName]: createConfigExtension(extensionName, schema)
};
}
_static_cache = {
timestamp: Date.now(),
data: result
};
return result;
};
var createConfigExtension = (extensionName, schema) => {
const extension_cache_key = { extensionName };
if (_extension_cache.has(extension_cache_key)) {
return _extension_cache.get(extension_cache_key);
}
let extension = _chunkUJ77IBHDcjs.getExtensionEnv.call(void 0, extensionName);
if (schema) {
extension = schema.parse(extension);
}
_extension_cache.set(extension_cache_key, extension);
return extension;
};
var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
const config = await createStormWorkspaceConfig(
void 0,
void 0,
workspaceRoot,
skipLogs,
true
);
_chunkBZRTSWH4cjs.setConfigEnv.call(void 0, config);
if (!skipLogs && !config.skipConfigLogging) {
_chunkTZZRLM5Jcjs.writeTrace.call(void 0,
`\u2699\uFE0F Using Storm Workspace configuration:
${_chunkTZZRLM5Jcjs.formatLogMessage.call(void 0, config)}`,
config
);
}
return config;
};
var tryLoadStormWorkspaceConfig = async (workspaceRoot, skipLogs = true, useDefault = false) => {
try {
const config = await createStormWorkspaceConfig(
void 0,
void 0,
workspaceRoot,
skipLogs,
useDefault
);
if (!config) {
return void 0;
}
_chunkBZRTSWH4cjs.setConfigEnv.call(void 0, config);
if (!skipLogs && !config.skipConfigLogging) {
_chunkTZZRLM5Jcjs.writeTrace.call(void 0,
`\u2699\uFE0F Using Storm Workspace configuration:
${_chunkTZZRLM5Jcjs.formatLogMessage.call(void 0, config)}`,
config
);
}
return config;
} catch (error) {
if (!skipLogs) {
_chunkTZZRLM5Jcjs.writeWarning.call(void 0,
`\u26A0\uFE0F Failed to load Storm Workspace configuration: ${error}`,
{ logLevel: "all" }
);
}
return void 0;
}
};
exports.createStormWorkspaceConfig = createStormWorkspaceConfig; exports.createConfigExtension = createConfigExtension; exports.loadStormWorkspaceConfig = loadStormWorkspaceConfig; exports.tryLoadStormWorkspaceConfig = tryLoadStormWorkspaceConfig;
import {
findFolderUp
} from "./chunk-RUKM6FCF.js";
import {
correctPaths
} from "./chunk-V3GMJ4TX.js";
// src/utilities/find-workspace-root.ts
var rootFiles = [
"storm-workspace.json",
"storm-workspace.yaml",
"storm-workspace.yml",
"storm-workspace.js",
"storm-workspace.ts",
".storm-workspace.json",
".storm-workspace.yaml",
".storm-workspace.yml",
".storm-workspace.js",
".storm-workspace.ts",
"lerna.json",
"nx.json",
"turbo.json",
"npm-workspace.json",
"yarn-workspace.json",
"pnpm-workspace.json",
"npm-workspace.yaml",
"yarn-workspace.yaml",
"pnpm-workspace.yaml",
"npm-workspace.yml",
"yarn-workspace.yml",
"pnpm-workspace.yml",
"npm-lock.json",
"yarn-lock.json",
"pnpm-lock.json",
"npm-lock.yaml",
"yarn-lock.yaml",
"pnpm-lock.yaml",
"npm-lock.yml",
"yarn-lock.yml",
"pnpm-lock.yml",
"bun.lockb",
"bun.lock",
"bunfig.toml"
];
var rootDirectories = [
".storm-workspace",
".nx",
".git",
".github",
".vscode",
".verdaccio"
];
function findWorkspaceRootSafe(pathInsideMonorepo) {
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
return correctPaths(
process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH
);
}
return correctPaths(
findFolderUp(
pathInsideMonorepo ?? process.cwd(),
rootFiles,
rootDirectories
)
);
}
function findWorkspaceRoot(pathInsideMonorepo) {
const result = findWorkspaceRootSafe(pathInsideMonorepo);
if (!result) {
throw new Error(
`Cannot find workspace root upwards from known path. Files search list includes:
${rootFiles.join(
"\n"
)}
Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
);
}
return result;
}
export {
findWorkspaceRootSafe,
findWorkspaceRoot
};
"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; }
var _chunkIWQRXQ4Ncjs = require('./chunk-IWQRXQ4N.cjs');
var _chunkBDATZ3UBcjs = require('./chunk-BDATZ3UB.cjs');
// src/utilities/get-default-config.ts
var _config = require('@storm-software/config');
var _fs = require('fs');
var _promises = require('fs/promises');
var _path = require('path');
async function getPackageJsonConfig(root) {
let license = _config.STORM_DEFAULT_LICENSE;
let homepage = void 0;
let support = void 0;
let name = void 0;
let namespace = void 0;
let repository = void 0;
const workspaceRoot = _chunkIWQRXQ4Ncjs.findWorkspaceRoot.call(void 0, root);
if (_fs.existsSync.call(void 0, _path.join.call(void 0, workspaceRoot, "package.json"))) {
const file = await _promises.readFile.call(void 0,
_chunkBDATZ3UBcjs.joinPaths.call(void 0, workspaceRoot, "package.json"),
"utf8"
);
if (file) {
const packageJson = JSON.parse(file);
if (packageJson.name) {
name = packageJson.name;
}
if (packageJson.namespace) {
namespace = packageJson.namespace;
}
if (packageJson.repository) {
if (typeof packageJson.repository === "string") {
repository = packageJson.repository;
} else if (packageJson.repository.url) {
repository = packageJson.repository.url;
}
}
if (packageJson.license) {
license = packageJson.license;
}
if (packageJson.homepage) {
homepage = packageJson.homepage;
}
if (packageJson.bugs) {
if (typeof packageJson.bugs === "string") {
support = packageJson.bugs;
} else if (packageJson.bugs.url) {
support = packageJson.bugs.url;
}
}
}
}
return {
workspaceRoot,
name,
namespace,
repository,
license,
homepage,
support
};
}
function applyDefaultConfig(config) {
if (!config.support && config.contact) {
config.support = config.contact;
}
if (!config.contact && config.support) {
config.contact = config.support;
}
if (config.homepage) {
if (!config.docs) {
config.docs = `${config.homepage}/docs`;
}
if (!config.license) {
config.license = `${config.homepage}/license`;
}
if (!config.support) {
config.support = `${config.homepage}/support`;
}
if (!config.contact) {
config.contact = `${config.homepage}/contact`;
}
if (!_optionalChain([config, 'access', _ => _.error, 'optionalAccess', _2 => _2.codesFile]) || !_optionalChain([config, 'optionalAccess', _3 => _3.error, 'optionalAccess', _4 => _4.url])) {
config.error ??= { codesFile: _config.STORM_DEFAULT_ERROR_CODES_FILE };
if (config.homepage) {
config.error.url ??= `${config.homepage}/errors`;
}
}
}
return config;
}
exports.getPackageJsonConfig = getPackageJsonConfig; exports.applyDefaultConfig = applyDefaultConfig;
+3
-1

@@ -601,3 +601,5 @@ #!/usr/bin/env node

"pnpm-lock.yml",
"bun.lockb"
"bun.lockb",
"bun.lock",
"bunfig.toml"
];

@@ -604,0 +606,0 @@ var rootDirectories = [

@@ -568,3 +568,5 @@ #!/usr/bin/env node

"pnpm-lock.yml",
"bun.lockb"
"bun.lockb",
"bun.lock",
"bunfig.toml"
];

@@ -571,0 +573,0 @@ var rootDirectories = [

"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkIJBWQJQWcjs = require('../chunk-IJBWQJQW.cjs');
var _chunkMSAQEGBKcjs = require('../chunk-MSAQEGBK.cjs');
require('../chunk-3COHMHPU.cjs');

@@ -9,6 +9,6 @@ require('../chunk-COOUXVIB.cjs');

require('../chunk-MBG2FTBL.cjs');
require('../chunk-EMO3BY53.cjs');
require('../chunk-24B36RDB.cjs');
require('../chunk-2WBD2G3E.cjs');
require('../chunk-CFXT4ZAW.cjs');
require('../chunk-3CNCDDWZ.cjs');
require('../chunk-T7YISGRS.cjs');
require('../chunk-IWQRXQ4N.cjs');
require('../chunk-NJFLUTGH.cjs');

@@ -29,2 +29,2 @@ require('../chunk-7PV6L7I7.cjs');

exports.getConfigFile = _chunkIJBWQJQWcjs.getConfigFile; exports.getConfigFileByName = _chunkIJBWQJQWcjs.getConfigFileByName;
exports.getConfigFile = _chunkMSAQEGBKcjs.getConfigFile; exports.getConfigFileByName = _chunkMSAQEGBKcjs.getConfigFileByName;
import {
getConfigFile,
getConfigFileByName
} from "../chunk-IUVY5TOB.js";
} from "../chunk-5C7PIENF.js";
import "../chunk-UKGRDKIH.js";

@@ -9,6 +9,6 @@ import "../chunk-KL53DGPX.js";

import "../chunk-YX4736HU.js";
import "../chunk-XEHBJ73S.js";
import "../chunk-HFS7WJVW.js";
import "../chunk-KSMN3HSC.js";
import "../chunk-RGET2UQV.js";
import "../chunk-LF3SAK2O.js";
import "../chunk-MQG74XF7.js";
import "../chunk-SO3FWVXC.js";
import "../chunk-RUKM6FCF.js";

@@ -15,0 +15,0 @@ import "../chunk-RRKB32OH.js";

@@ -5,3 +5,3 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-IWD6YQKX.cjs');

var _chunkIJBWQJQWcjs = require('../chunk-IJBWQJQW.cjs');
var _chunkMSAQEGBKcjs = require('../chunk-MSAQEGBK.cjs');
require('../chunk-3COHMHPU.cjs');

@@ -11,6 +11,6 @@ require('../chunk-COOUXVIB.cjs');

require('../chunk-MBG2FTBL.cjs');
require('../chunk-EMO3BY53.cjs');
require('../chunk-24B36RDB.cjs');
require('../chunk-2WBD2G3E.cjs');
require('../chunk-CFXT4ZAW.cjs');
require('../chunk-3CNCDDWZ.cjs');
require('../chunk-T7YISGRS.cjs');
require('../chunk-IWQRXQ4N.cjs');
require('../chunk-NJFLUTGH.cjs');

@@ -31,2 +31,2 @@ require('../chunk-7PV6L7I7.cjs');

exports.getConfigFile = _chunkIJBWQJQWcjs.getConfigFile; exports.getConfigFileByName = _chunkIJBWQJQWcjs.getConfigFileByName;
exports.getConfigFile = _chunkMSAQEGBKcjs.getConfigFile; exports.getConfigFileByName = _chunkMSAQEGBKcjs.getConfigFileByName;

@@ -5,3 +5,3 @@ import "../chunk-2AVLCXLT.js";

getConfigFileByName
} from "../chunk-IUVY5TOB.js";
} from "../chunk-5C7PIENF.js";
import "../chunk-UKGRDKIH.js";

@@ -11,6 +11,6 @@ import "../chunk-KL53DGPX.js";

import "../chunk-YX4736HU.js";
import "../chunk-XEHBJ73S.js";
import "../chunk-HFS7WJVW.js";
import "../chunk-KSMN3HSC.js";
import "../chunk-RGET2UQV.js";
import "../chunk-LF3SAK2O.js";
import "../chunk-MQG74XF7.js";
import "../chunk-SO3FWVXC.js";
import "../chunk-RUKM6FCF.js";

@@ -17,0 +17,0 @@ import "../chunk-RRKB32OH.js";

@@ -6,4 +6,4 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true});

var _chunkTX2VIMVXcjs = require('./chunk-TX2VIMVX.cjs');
require('./chunk-IJBWQJQW.cjs');
var _chunkSLICWTO2cjs = require('./chunk-SLICWTO2.cjs');
require('./chunk-MSAQEGBK.cjs');
require('./chunk-3COHMHPU.cjs');

@@ -13,6 +13,6 @@ require('./chunk-COOUXVIB.cjs');

require('./chunk-MBG2FTBL.cjs');
require('./chunk-EMO3BY53.cjs');
require('./chunk-24B36RDB.cjs');
require('./chunk-2WBD2G3E.cjs');
require('./chunk-CFXT4ZAW.cjs');
require('./chunk-3CNCDDWZ.cjs');
require('./chunk-T7YISGRS.cjs');
require('./chunk-IWQRXQ4N.cjs');
require('./chunk-NJFLUTGH.cjs');

@@ -37,2 +37,2 @@ require('./chunk-7PV6L7I7.cjs');

exports.createConfigExtension = _chunkTX2VIMVXcjs.createConfigExtension; exports.createStormWorkspaceConfig = _chunkTX2VIMVXcjs.createStormWorkspaceConfig; exports.loadStormWorkspaceConfig = _chunkTX2VIMVXcjs.loadStormWorkspaceConfig; exports.tryLoadStormWorkspaceConfig = _chunkTX2VIMVXcjs.tryLoadStormWorkspaceConfig;
exports.createConfigExtension = _chunkSLICWTO2cjs.createConfigExtension; exports.createStormWorkspaceConfig = _chunkSLICWTO2cjs.createStormWorkspaceConfig; exports.loadStormWorkspaceConfig = _chunkSLICWTO2cjs.loadStormWorkspaceConfig; exports.tryLoadStormWorkspaceConfig = _chunkSLICWTO2cjs.tryLoadStormWorkspaceConfig;

@@ -6,4 +6,4 @@ import {

tryLoadStormWorkspaceConfig
} from "./chunk-J777WNCU.js";
import "./chunk-IUVY5TOB.js";
} from "./chunk-4Q45WJYQ.js";
import "./chunk-5C7PIENF.js";
import "./chunk-UKGRDKIH.js";

@@ -13,6 +13,6 @@ import "./chunk-KL53DGPX.js";

import "./chunk-YX4736HU.js";
import "./chunk-XEHBJ73S.js";
import "./chunk-HFS7WJVW.js";
import "./chunk-KSMN3HSC.js";
import "./chunk-RGET2UQV.js";
import "./chunk-LF3SAK2O.js";
import "./chunk-MQG74XF7.js";
import "./chunk-SO3FWVXC.js";
import "./chunk-RUKM6FCF.js";

@@ -19,0 +19,0 @@ import "./chunk-RRKB32OH.js";

@@ -5,5 +5,5 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true});

var _chunkKT4DY2AScjs = require('./chunk-KT4DY2AS.cjs');
require('./chunk-TX2VIMVX.cjs');
require('./chunk-IJBWQJQW.cjs');
var _chunkPCYB64MBcjs = require('./chunk-PCYB64MB.cjs');
require('./chunk-SLICWTO2.cjs');
require('./chunk-MSAQEGBK.cjs');
require('./chunk-3COHMHPU.cjs');

@@ -13,6 +13,6 @@ require('./chunk-COOUXVIB.cjs');

require('./chunk-MBG2FTBL.cjs');
require('./chunk-EMO3BY53.cjs');
require('./chunk-24B36RDB.cjs');
require('./chunk-2WBD2G3E.cjs');
require('./chunk-CFXT4ZAW.cjs');
require('./chunk-3CNCDDWZ.cjs');
require('./chunk-T7YISGRS.cjs');
require('./chunk-IWQRXQ4N.cjs');
require('./chunk-NJFLUTGH.cjs');

@@ -36,2 +36,2 @@ require('./chunk-7PV6L7I7.cjs');

exports.getConfig = _chunkKT4DY2AScjs.getConfig; exports.getWorkspaceConfig = _chunkKT4DY2AScjs.getWorkspaceConfig; exports.tryGetWorkspaceConfig = _chunkKT4DY2AScjs.tryGetWorkspaceConfig;
exports.getConfig = _chunkPCYB64MBcjs.getConfig; exports.getWorkspaceConfig = _chunkPCYB64MBcjs.getWorkspaceConfig; exports.tryGetWorkspaceConfig = _chunkPCYB64MBcjs.tryGetWorkspaceConfig;

@@ -5,5 +5,5 @@ import {

tryGetWorkspaceConfig
} from "./chunk-ZXR7SS2X.js";
import "./chunk-J777WNCU.js";
import "./chunk-IUVY5TOB.js";
} from "./chunk-27N3QEX5.js";
import "./chunk-4Q45WJYQ.js";
import "./chunk-5C7PIENF.js";
import "./chunk-UKGRDKIH.js";

@@ -13,6 +13,6 @@ import "./chunk-KL53DGPX.js";

import "./chunk-YX4736HU.js";
import "./chunk-XEHBJ73S.js";
import "./chunk-HFS7WJVW.js";
import "./chunk-KSMN3HSC.js";
import "./chunk-RGET2UQV.js";
import "./chunk-LF3SAK2O.js";
import "./chunk-MQG74XF7.js";
import "./chunk-SO3FWVXC.js";
import "./chunk-RUKM6FCF.js";

@@ -19,0 +19,0 @@ import "./chunk-RRKB32OH.js";

@@ -5,3 +5,3 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true});

var _chunkKT4DY2AScjs = require('./chunk-KT4DY2AS.cjs');
var _chunkPCYB64MBcjs = require('./chunk-PCYB64MB.cjs');

@@ -12,3 +12,3 @@

var _chunkTX2VIMVXcjs = require('./chunk-TX2VIMVX.cjs');
var _chunkSLICWTO2cjs = require('./chunk-SLICWTO2.cjs');
require('./chunk-IWD6YQKX.cjs');

@@ -18,3 +18,3 @@

var _chunkIJBWQJQWcjs = require('./chunk-IJBWQJQW.cjs');
var _chunkMSAQEGBKcjs = require('./chunk-MSAQEGBK.cjs');
require('./chunk-3COHMHPU.cjs');

@@ -42,3 +42,3 @@

var _chunkEMO3BY53cjs = require('./chunk-EMO3BY53.cjs');
var _chunk24B36RDBcjs = require('./chunk-24B36RDB.cjs');

@@ -52,7 +52,7 @@

var _chunkCFXT4ZAWcjs = require('./chunk-CFXT4ZAW.cjs');
var _chunkT7YISGRScjs = require('./chunk-T7YISGRS.cjs');
var _chunk3CNCDDWZcjs = require('./chunk-3CNCDDWZ.cjs');
var _chunkIWQRXQ4Ncjs = require('./chunk-IWQRXQ4N.cjs');
require('./chunk-NJFLUTGH.cjs');

@@ -206,2 +206,2 @@ require('./chunk-7PV6L7I7.cjs');

exports.CONSOLE_ICONS = _chunkEC2KPWRGcjs.CONSOLE_ICONS; exports.DEFAULT_COLOR_CONFIG = _chunkFMDVBSP6cjs.DEFAULT_COLOR_CONFIG; exports.LARGE_BUFFER = _chunk6Y623TCScjs.LARGE_BUFFER; exports.LogLevel = _chunk7QBTVNMRcjs.LogLevel; exports.LogLevelLabel = _chunk7QBTVNMRcjs.LogLevelLabel; exports.applyDefaultConfig = _chunkCFXT4ZAWcjs.applyDefaultConfig; exports.applyWorkspaceBaseTokens = _chunkEMO3BY53cjs.applyWorkspaceBaseTokens; exports.applyWorkspaceProjectTokens = _chunkEMO3BY53cjs.applyWorkspaceProjectTokens; exports.applyWorkspaceTokens = _chunkEMO3BY53cjs.applyWorkspaceTokens; exports.basename = _chunkBDATZ3UBcjs.basename; exports.brandIcon = _chunkTZZRLM5Jcjs.brandIcon; exports.correctPaths = _chunkBDATZ3UBcjs.correctPaths; exports.createConfigExtension = _chunkTX2VIMVXcjs.createConfigExtension; exports.createLogger = _chunkENI4UUSKcjs.createLogger; exports.createStormWorkspaceConfig = _chunkTX2VIMVXcjs.createStormWorkspaceConfig; exports.dirname = _chunkBDATZ3UBcjs.dirname; exports.exitWithError = _chunkCOOUXVIBcjs.exitWithError; exports.exitWithSuccess = _chunkCOOUXVIBcjs.exitWithSuccess; exports.extname = _chunkBDATZ3UBcjs.extname; exports.findFileName = _chunk2WBD2G3Ecjs.findFileName; exports.findFilePath = _chunk2WBD2G3Ecjs.findFilePath; exports.findWorkspaceRoot = _chunk3CNCDDWZcjs.findWorkspaceRoot; exports.findWorkspaceRootSafe = _chunk3CNCDDWZcjs.findWorkspaceRootSafe; exports.format = _chunkBDATZ3UBcjs.format; exports.formatLogMessage = _chunkTZZRLM5Jcjs.formatLogMessage; exports.formatTimestamp = _chunkWQJYIPSLcjs.formatTimestamp; exports.getChalk = _chunkLOY6ICHZcjs.getChalk; exports.getColor = _chunkFMDVBSP6cjs.getColor; exports.getColors = _chunkFMDVBSP6cjs.getColors; exports.getConfig = _chunkKT4DY2AScjs.getConfig; exports.getConfigEnv = _chunkUJ77IBHDcjs.getConfigEnv; exports.getConfigFile = _chunkIJBWQJQWcjs.getConfigFile; exports.getConfigFileByName = _chunkIJBWQJQWcjs.getConfigFileByName; exports.getExtensionEnv = _chunkUJ77IBHDcjs.getExtensionEnv; exports.getGradient = _chunkFMDVBSP6cjs.getGradient; exports.getLogFn = _chunkTZZRLM5Jcjs.getLogFn; exports.getLogLevel = _chunkJWLDCEBZcjs.getLogLevel; exports.getLogLevelLabel = _chunkJWLDCEBZcjs.getLogLevelLabel; exports.getPackageJsonConfig = _chunkCFXT4ZAWcjs.getPackageJsonConfig; exports.getStopwatch = _chunkTZZRLM5Jcjs.getStopwatch; exports.getWorkspaceConfig = _chunkKT4DY2AScjs.getWorkspaceConfig; exports.handleProcess = _chunkCOOUXVIBcjs.handleProcess; exports.isAbsolute = _chunkBDATZ3UBcjs.isAbsolute; exports.isUnicodeSupported = _chunkDTGT4OI3cjs.isUnicodeSupported; exports.isVerbose = _chunkJWLDCEBZcjs.isVerbose; exports.joinPaths = _chunkBDATZ3UBcjs.joinPaths; exports.loadStormWorkspaceConfig = _chunkTX2VIMVXcjs.loadStormWorkspaceConfig; exports.modifyCargoNestedTable = _chunkMBG2FTBLcjs.modifyCargoNestedTable; exports.modifyCargoTable = _chunkMBG2FTBLcjs.modifyCargoTable; exports.normalizeString = _chunkBDATZ3UBcjs.normalizeString; exports.normalizeWindowsPath = _chunkBDATZ3UBcjs.normalizeWindowsPath; exports.parse = _chunkBDATZ3UBcjs.parse; exports.parseCargoToml = _chunkMBG2FTBLcjs.parseCargoToml; exports.parseCargoTomlWithTree = _chunkMBG2FTBLcjs.parseCargoTomlWithTree; exports.relative = _chunkBDATZ3UBcjs.relative; exports.removeExtension = _chunk2WBD2G3Ecjs.removeExtension; exports.resolve = _chunkBDATZ3UBcjs.resolve; exports.run = _chunk6Y623TCScjs.run; exports.runAsync = _chunk6Y623TCScjs.runAsync; exports.sep = _chunkBDATZ3UBcjs.sep; exports.setConfigEnv = _chunkBZRTSWH4cjs.setConfigEnv; exports.setExtensionEnv = _chunkBZRTSWH4cjs.setExtensionEnv; exports.stringifyCargoToml = _chunkMBG2FTBLcjs.stringifyCargoToml; exports.toNamespacedPath = _chunkBDATZ3UBcjs.toNamespacedPath; exports.tryGetWorkspaceConfig = _chunkKT4DY2AScjs.tryGetWorkspaceConfig; exports.tryLoadStormWorkspaceConfig = _chunkTX2VIMVXcjs.tryLoadStormWorkspaceConfig; exports.writeDebug = _chunkTZZRLM5Jcjs.writeDebug; exports.writeError = _chunkTZZRLM5Jcjs.writeError; exports.writeFatal = _chunkTZZRLM5Jcjs.writeFatal; exports.writeInfo = _chunkTZZRLM5Jcjs.writeInfo; exports.writePerformance = _chunkTZZRLM5Jcjs.writePerformance; exports.writeSuccess = _chunkTZZRLM5Jcjs.writeSuccess; exports.writeSystem = _chunkTZZRLM5Jcjs.writeSystem; exports.writeTrace = _chunkTZZRLM5Jcjs.writeTrace; exports.writeWarning = _chunkTZZRLM5Jcjs.writeWarning;
exports.CONSOLE_ICONS = _chunkEC2KPWRGcjs.CONSOLE_ICONS; exports.DEFAULT_COLOR_CONFIG = _chunkFMDVBSP6cjs.DEFAULT_COLOR_CONFIG; exports.LARGE_BUFFER = _chunk6Y623TCScjs.LARGE_BUFFER; exports.LogLevel = _chunk7QBTVNMRcjs.LogLevel; exports.LogLevelLabel = _chunk7QBTVNMRcjs.LogLevelLabel; exports.applyDefaultConfig = _chunkT7YISGRScjs.applyDefaultConfig; exports.applyWorkspaceBaseTokens = _chunk24B36RDBcjs.applyWorkspaceBaseTokens; exports.applyWorkspaceProjectTokens = _chunk24B36RDBcjs.applyWorkspaceProjectTokens; exports.applyWorkspaceTokens = _chunk24B36RDBcjs.applyWorkspaceTokens; exports.basename = _chunkBDATZ3UBcjs.basename; exports.brandIcon = _chunkTZZRLM5Jcjs.brandIcon; exports.correctPaths = _chunkBDATZ3UBcjs.correctPaths; exports.createConfigExtension = _chunkSLICWTO2cjs.createConfigExtension; exports.createLogger = _chunkENI4UUSKcjs.createLogger; exports.createStormWorkspaceConfig = _chunkSLICWTO2cjs.createStormWorkspaceConfig; exports.dirname = _chunkBDATZ3UBcjs.dirname; exports.exitWithError = _chunkCOOUXVIBcjs.exitWithError; exports.exitWithSuccess = _chunkCOOUXVIBcjs.exitWithSuccess; exports.extname = _chunkBDATZ3UBcjs.extname; exports.findFileName = _chunk2WBD2G3Ecjs.findFileName; exports.findFilePath = _chunk2WBD2G3Ecjs.findFilePath; exports.findWorkspaceRoot = _chunkIWQRXQ4Ncjs.findWorkspaceRoot; exports.findWorkspaceRootSafe = _chunkIWQRXQ4Ncjs.findWorkspaceRootSafe; exports.format = _chunkBDATZ3UBcjs.format; exports.formatLogMessage = _chunkTZZRLM5Jcjs.formatLogMessage; exports.formatTimestamp = _chunkWQJYIPSLcjs.formatTimestamp; exports.getChalk = _chunkLOY6ICHZcjs.getChalk; exports.getColor = _chunkFMDVBSP6cjs.getColor; exports.getColors = _chunkFMDVBSP6cjs.getColors; exports.getConfig = _chunkPCYB64MBcjs.getConfig; exports.getConfigEnv = _chunkUJ77IBHDcjs.getConfigEnv; exports.getConfigFile = _chunkMSAQEGBKcjs.getConfigFile; exports.getConfigFileByName = _chunkMSAQEGBKcjs.getConfigFileByName; exports.getExtensionEnv = _chunkUJ77IBHDcjs.getExtensionEnv; exports.getGradient = _chunkFMDVBSP6cjs.getGradient; exports.getLogFn = _chunkTZZRLM5Jcjs.getLogFn; exports.getLogLevel = _chunkJWLDCEBZcjs.getLogLevel; exports.getLogLevelLabel = _chunkJWLDCEBZcjs.getLogLevelLabel; exports.getPackageJsonConfig = _chunkT7YISGRScjs.getPackageJsonConfig; exports.getStopwatch = _chunkTZZRLM5Jcjs.getStopwatch; exports.getWorkspaceConfig = _chunkPCYB64MBcjs.getWorkspaceConfig; exports.handleProcess = _chunkCOOUXVIBcjs.handleProcess; exports.isAbsolute = _chunkBDATZ3UBcjs.isAbsolute; exports.isUnicodeSupported = _chunkDTGT4OI3cjs.isUnicodeSupported; exports.isVerbose = _chunkJWLDCEBZcjs.isVerbose; exports.joinPaths = _chunkBDATZ3UBcjs.joinPaths; exports.loadStormWorkspaceConfig = _chunkSLICWTO2cjs.loadStormWorkspaceConfig; exports.modifyCargoNestedTable = _chunkMBG2FTBLcjs.modifyCargoNestedTable; exports.modifyCargoTable = _chunkMBG2FTBLcjs.modifyCargoTable; exports.normalizeString = _chunkBDATZ3UBcjs.normalizeString; exports.normalizeWindowsPath = _chunkBDATZ3UBcjs.normalizeWindowsPath; exports.parse = _chunkBDATZ3UBcjs.parse; exports.parseCargoToml = _chunkMBG2FTBLcjs.parseCargoToml; exports.parseCargoTomlWithTree = _chunkMBG2FTBLcjs.parseCargoTomlWithTree; exports.relative = _chunkBDATZ3UBcjs.relative; exports.removeExtension = _chunk2WBD2G3Ecjs.removeExtension; exports.resolve = _chunkBDATZ3UBcjs.resolve; exports.run = _chunk6Y623TCScjs.run; exports.runAsync = _chunk6Y623TCScjs.runAsync; exports.sep = _chunkBDATZ3UBcjs.sep; exports.setConfigEnv = _chunkBZRTSWH4cjs.setConfigEnv; exports.setExtensionEnv = _chunkBZRTSWH4cjs.setExtensionEnv; exports.stringifyCargoToml = _chunkMBG2FTBLcjs.stringifyCargoToml; exports.toNamespacedPath = _chunkBDATZ3UBcjs.toNamespacedPath; exports.tryGetWorkspaceConfig = _chunkPCYB64MBcjs.tryGetWorkspaceConfig; exports.tryLoadStormWorkspaceConfig = _chunkSLICWTO2cjs.tryLoadStormWorkspaceConfig; exports.writeDebug = _chunkTZZRLM5Jcjs.writeDebug; exports.writeError = _chunkTZZRLM5Jcjs.writeError; exports.writeFatal = _chunkTZZRLM5Jcjs.writeFatal; exports.writeInfo = _chunkTZZRLM5Jcjs.writeInfo; exports.writePerformance = _chunkTZZRLM5Jcjs.writePerformance; exports.writeSuccess = _chunkTZZRLM5Jcjs.writeSuccess; exports.writeSystem = _chunkTZZRLM5Jcjs.writeSystem; exports.writeTrace = _chunkTZZRLM5Jcjs.writeTrace; exports.writeWarning = _chunkTZZRLM5Jcjs.writeWarning;

@@ -5,3 +5,3 @@ import {

tryGetWorkspaceConfig
} from "./chunk-ZXR7SS2X.js";
} from "./chunk-27N3QEX5.js";
import {

@@ -12,3 +12,3 @@ createConfigExtension,

tryLoadStormWorkspaceConfig
} from "./chunk-J777WNCU.js";
} from "./chunk-4Q45WJYQ.js";
import "./chunk-2AVLCXLT.js";

@@ -18,3 +18,3 @@ import {

getConfigFileByName
} from "./chunk-IUVY5TOB.js";
} from "./chunk-5C7PIENF.js";
import "./chunk-UKGRDKIH.js";

@@ -42,3 +42,3 @@ import {

applyWorkspaceTokens
} from "./chunk-XEHBJ73S.js";
} from "./chunk-HFS7WJVW.js";
import {

@@ -52,7 +52,7 @@ findFileName,

getPackageJsonConfig
} from "./chunk-RGET2UQV.js";
} from "./chunk-MQG74XF7.js";
import {
findWorkspaceRoot,
findWorkspaceRootSafe
} from "./chunk-LF3SAK2O.js";
} from "./chunk-SO3FWVXC.js";
import "./chunk-RUKM6FCF.js";

@@ -59,0 +59,0 @@ import "./chunk-RRKB32OH.js";

@@ -5,4 +5,4 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true});

var _chunkEMO3BY53cjs = require('../chunk-EMO3BY53.cjs');
require('../chunk-3CNCDDWZ.cjs');
var _chunk24B36RDBcjs = require('../chunk-24B36RDB.cjs');
require('../chunk-IWQRXQ4N.cjs');
require('../chunk-NJFLUTGH.cjs');

@@ -14,2 +14,2 @@ require('../chunk-BDATZ3UB.cjs');

exports.applyWorkspaceBaseTokens = _chunkEMO3BY53cjs.applyWorkspaceBaseTokens; exports.applyWorkspaceProjectTokens = _chunkEMO3BY53cjs.applyWorkspaceProjectTokens; exports.applyWorkspaceTokens = _chunkEMO3BY53cjs.applyWorkspaceTokens;
exports.applyWorkspaceBaseTokens = _chunk24B36RDBcjs.applyWorkspaceBaseTokens; exports.applyWorkspaceProjectTokens = _chunk24B36RDBcjs.applyWorkspaceProjectTokens; exports.applyWorkspaceTokens = _chunk24B36RDBcjs.applyWorkspaceTokens;

@@ -5,4 +5,4 @@ import {

applyWorkspaceTokens
} from "../chunk-XEHBJ73S.js";
import "../chunk-LF3SAK2O.js";
} from "../chunk-HFS7WJVW.js";
import "../chunk-SO3FWVXC.js";
import "../chunk-RUKM6FCF.js";

@@ -9,0 +9,0 @@ import "../chunk-V3GMJ4TX.js";

"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunk3CNCDDWZcjs = require('../chunk-3CNCDDWZ.cjs');
var _chunkIWQRXQ4Ncjs = require('../chunk-IWQRXQ4N.cjs');
require('../chunk-NJFLUTGH.cjs');

@@ -10,2 +10,2 @@ require('../chunk-BDATZ3UB.cjs');

exports.findWorkspaceRoot = _chunk3CNCDDWZcjs.findWorkspaceRoot; exports.findWorkspaceRootSafe = _chunk3CNCDDWZcjs.findWorkspaceRootSafe;
exports.findWorkspaceRoot = _chunkIWQRXQ4Ncjs.findWorkspaceRoot; exports.findWorkspaceRootSafe = _chunkIWQRXQ4Ncjs.findWorkspaceRootSafe;
import {
findWorkspaceRoot,
findWorkspaceRootSafe
} from "../chunk-LF3SAK2O.js";
} from "../chunk-SO3FWVXC.js";
import "../chunk-RUKM6FCF.js";

@@ -6,0 +6,0 @@ import "../chunk-V3GMJ4TX.js";

"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkCFXT4ZAWcjs = require('../chunk-CFXT4ZAW.cjs');
require('../chunk-3CNCDDWZ.cjs');
var _chunkT7YISGRScjs = require('../chunk-T7YISGRS.cjs');
require('../chunk-IWQRXQ4N.cjs');
require('../chunk-NJFLUTGH.cjs');

@@ -11,2 +11,2 @@ require('../chunk-BDATZ3UB.cjs');

exports.applyDefaultConfig = _chunkCFXT4ZAWcjs.applyDefaultConfig; exports.getPackageJsonConfig = _chunkCFXT4ZAWcjs.getPackageJsonConfig;
exports.applyDefaultConfig = _chunkT7YISGRScjs.applyDefaultConfig; exports.getPackageJsonConfig = _chunkT7YISGRScjs.getPackageJsonConfig;
import {
applyDefaultConfig,
getPackageJsonConfig
} from "../chunk-RGET2UQV.js";
import "../chunk-LF3SAK2O.js";
} from "../chunk-MQG74XF7.js";
import "../chunk-SO3FWVXC.js";
import "../chunk-RUKM6FCF.js";

@@ -7,0 +7,0 @@ import "../chunk-V3GMJ4TX.js";

@@ -23,3 +23,3 @@ "use strict";Object.defineProperty(exports, "__esModule", {value: true});require('../chunk-3COHMHPU.cjs');

var _chunkEMO3BY53cjs = require('../chunk-EMO3BY53.cjs');
var _chunk24B36RDBcjs = require('../chunk-24B36RDB.cjs');

@@ -33,7 +33,7 @@

var _chunkCFXT4ZAWcjs = require('../chunk-CFXT4ZAW.cjs');
var _chunkT7YISGRScjs = require('../chunk-T7YISGRS.cjs');
var _chunk3CNCDDWZcjs = require('../chunk-3CNCDDWZ.cjs');
var _chunkIWQRXQ4Ncjs = require('../chunk-IWQRXQ4N.cjs');
require('../chunk-NJFLUTGH.cjs');

@@ -111,2 +111,2 @@ require('../chunk-7PV6L7I7.cjs');

exports.DEFAULT_COLOR_CONFIG = _chunkFMDVBSP6cjs.DEFAULT_COLOR_CONFIG; exports.LARGE_BUFFER = _chunk6Y623TCScjs.LARGE_BUFFER; exports.applyDefaultConfig = _chunkCFXT4ZAWcjs.applyDefaultConfig; exports.applyWorkspaceBaseTokens = _chunkEMO3BY53cjs.applyWorkspaceBaseTokens; exports.applyWorkspaceProjectTokens = _chunkEMO3BY53cjs.applyWorkspaceProjectTokens; exports.applyWorkspaceTokens = _chunkEMO3BY53cjs.applyWorkspaceTokens; exports.basename = _chunkBDATZ3UBcjs.basename; exports.correctPaths = _chunkBDATZ3UBcjs.correctPaths; exports.dirname = _chunkBDATZ3UBcjs.dirname; exports.exitWithError = _chunkCOOUXVIBcjs.exitWithError; exports.exitWithSuccess = _chunkCOOUXVIBcjs.exitWithSuccess; exports.extname = _chunkBDATZ3UBcjs.extname; exports.findFileName = _chunk2WBD2G3Ecjs.findFileName; exports.findFilePath = _chunk2WBD2G3Ecjs.findFilePath; exports.findWorkspaceRoot = _chunk3CNCDDWZcjs.findWorkspaceRoot; exports.findWorkspaceRootSafe = _chunk3CNCDDWZcjs.findWorkspaceRootSafe; exports.format = _chunkBDATZ3UBcjs.format; exports.getColor = _chunkFMDVBSP6cjs.getColor; exports.getColors = _chunkFMDVBSP6cjs.getColors; exports.getGradient = _chunkFMDVBSP6cjs.getGradient; exports.getPackageJsonConfig = _chunkCFXT4ZAWcjs.getPackageJsonConfig; exports.handleProcess = _chunkCOOUXVIBcjs.handleProcess; exports.isAbsolute = _chunkBDATZ3UBcjs.isAbsolute; exports.joinPaths = _chunkBDATZ3UBcjs.joinPaths; exports.modifyCargoNestedTable = _chunkMBG2FTBLcjs.modifyCargoNestedTable; exports.modifyCargoTable = _chunkMBG2FTBLcjs.modifyCargoTable; exports.normalizeString = _chunkBDATZ3UBcjs.normalizeString; exports.normalizeWindowsPath = _chunkBDATZ3UBcjs.normalizeWindowsPath; exports.parse = _chunkBDATZ3UBcjs.parse; exports.parseCargoToml = _chunkMBG2FTBLcjs.parseCargoToml; exports.parseCargoTomlWithTree = _chunkMBG2FTBLcjs.parseCargoTomlWithTree; exports.relative = _chunkBDATZ3UBcjs.relative; exports.removeExtension = _chunk2WBD2G3Ecjs.removeExtension; exports.resolve = _chunkBDATZ3UBcjs.resolve; exports.run = _chunk6Y623TCScjs.run; exports.runAsync = _chunk6Y623TCScjs.runAsync; exports.sep = _chunkBDATZ3UBcjs.sep; exports.stringifyCargoToml = _chunkMBG2FTBLcjs.stringifyCargoToml; exports.toNamespacedPath = _chunkBDATZ3UBcjs.toNamespacedPath;
exports.DEFAULT_COLOR_CONFIG = _chunkFMDVBSP6cjs.DEFAULT_COLOR_CONFIG; exports.LARGE_BUFFER = _chunk6Y623TCScjs.LARGE_BUFFER; exports.applyDefaultConfig = _chunkT7YISGRScjs.applyDefaultConfig; exports.applyWorkspaceBaseTokens = _chunk24B36RDBcjs.applyWorkspaceBaseTokens; exports.applyWorkspaceProjectTokens = _chunk24B36RDBcjs.applyWorkspaceProjectTokens; exports.applyWorkspaceTokens = _chunk24B36RDBcjs.applyWorkspaceTokens; exports.basename = _chunkBDATZ3UBcjs.basename; exports.correctPaths = _chunkBDATZ3UBcjs.correctPaths; exports.dirname = _chunkBDATZ3UBcjs.dirname; exports.exitWithError = _chunkCOOUXVIBcjs.exitWithError; exports.exitWithSuccess = _chunkCOOUXVIBcjs.exitWithSuccess; exports.extname = _chunkBDATZ3UBcjs.extname; exports.findFileName = _chunk2WBD2G3Ecjs.findFileName; exports.findFilePath = _chunk2WBD2G3Ecjs.findFilePath; exports.findWorkspaceRoot = _chunkIWQRXQ4Ncjs.findWorkspaceRoot; exports.findWorkspaceRootSafe = _chunkIWQRXQ4Ncjs.findWorkspaceRootSafe; exports.format = _chunkBDATZ3UBcjs.format; exports.getColor = _chunkFMDVBSP6cjs.getColor; exports.getColors = _chunkFMDVBSP6cjs.getColors; exports.getGradient = _chunkFMDVBSP6cjs.getGradient; exports.getPackageJsonConfig = _chunkT7YISGRScjs.getPackageJsonConfig; exports.handleProcess = _chunkCOOUXVIBcjs.handleProcess; exports.isAbsolute = _chunkBDATZ3UBcjs.isAbsolute; exports.joinPaths = _chunkBDATZ3UBcjs.joinPaths; exports.modifyCargoNestedTable = _chunkMBG2FTBLcjs.modifyCargoNestedTable; exports.modifyCargoTable = _chunkMBG2FTBLcjs.modifyCargoTable; exports.normalizeString = _chunkBDATZ3UBcjs.normalizeString; exports.normalizeWindowsPath = _chunkBDATZ3UBcjs.normalizeWindowsPath; exports.parse = _chunkBDATZ3UBcjs.parse; exports.parseCargoToml = _chunkMBG2FTBLcjs.parseCargoToml; exports.parseCargoTomlWithTree = _chunkMBG2FTBLcjs.parseCargoTomlWithTree; exports.relative = _chunkBDATZ3UBcjs.relative; exports.removeExtension = _chunk2WBD2G3Ecjs.removeExtension; exports.resolve = _chunkBDATZ3UBcjs.resolve; exports.run = _chunk6Y623TCScjs.run; exports.runAsync = _chunk6Y623TCScjs.runAsync; exports.sep = _chunkBDATZ3UBcjs.sep; exports.stringifyCargoToml = _chunkMBG2FTBLcjs.stringifyCargoToml; exports.toNamespacedPath = _chunkBDATZ3UBcjs.toNamespacedPath;

@@ -23,3 +23,3 @@ import "../chunk-UKGRDKIH.js";

applyWorkspaceTokens
} from "../chunk-XEHBJ73S.js";
} from "../chunk-HFS7WJVW.js";
import {

@@ -33,7 +33,7 @@ findFileName,

getPackageJsonConfig
} from "../chunk-RGET2UQV.js";
} from "../chunk-MQG74XF7.js";
import {
findWorkspaceRoot,
findWorkspaceRootSafe
} from "../chunk-LF3SAK2O.js";
} from "../chunk-SO3FWVXC.js";
import "../chunk-RUKM6FCF.js";

@@ -40,0 +40,0 @@ import "../chunk-RRKB32OH.js";

{
"name": "@storm-software/config-tools",
"version": "1.190.98",
"version": "1.190.99",
"private": false,

@@ -215,3 +215,3 @@ "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.",

"@ltd/j-toml": "1.38.0",
"@storm-software/config": "^1.138.35",
"@storm-software/config": "^1.138.36",
"c12": "^2.0.4",

@@ -234,3 +234,3 @@ "chalk": "^4.1.2",

"publishConfig": { "access": "public" },
"gitHead": "752dcf7147a8e553e9f0375e33cacd3711b2a34b"
"gitHead": "f367412ee4e991808dbb5353fd9938daa04efd5e"
}

@@ -30,3 +30,3 @@ <!-- START header -->

[![Version](https://img.shields.io/badge/version-1.190.96-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)
[![Version](https://img.shields.io/badge/version-1.190.98-1fb2a6.svg?style=for-the-badge&color=1fb2a6)](https://prettier.io/)&nbsp;[![Nx](https://img.shields.io/badge/Nx-17.0.2-lightgrey?style=for-the-badge&logo=nx&logoWidth=20&&color=1fb2a6)](http://nx.dev/)&nbsp;[![NextJs](https://img.shields.io/badge/Next.js-14.0.2-lightgrey?style=for-the-badge&logo=nextdotjs&logoWidth=20&color=1fb2a6)](https://nextjs.org/)&nbsp;[![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg?style=for-the-badge&logo=commitlint&color=1fb2a6)](http://commitizen.github.io/cz-cli/)&nbsp;![Semantic-Release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg?style=for-the-badge&color=1fb2a6)&nbsp;[![documented with Fumadocs](https://img.shields.io/badge/documented_with-fumadocs-success.svg?style=for-the-badge&logo=readthedocs&color=1fb2a6)](https://fumadocs.vercel.app/)&nbsp;![GitHub Workflow Status (with event)](https://img.shields.io/github/actions/workflow/status/storm-software/storm-ops/cr.yml?style=for-the-badge&logo=github-actions&color=1fb2a6)

@@ -33,0 +33,0 @@ <!-- prettier-ignore-start -->

"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
var _chunkNJFLUTGHcjs = require('./chunk-NJFLUTGH.cjs');
var _chunkBDATZ3UBcjs = require('./chunk-BDATZ3UB.cjs');
// src/utilities/find-workspace-root.ts
var rootFiles = [
"storm-workspace.json",
"storm-workspace.yaml",
"storm-workspace.yml",
"storm-workspace.js",
"storm-workspace.ts",
".storm-workspace.json",
".storm-workspace.yaml",
".storm-workspace.yml",
".storm-workspace.js",
".storm-workspace.ts",
"lerna.json",
"nx.json",
"turbo.json",
"npm-workspace.json",
"yarn-workspace.json",
"pnpm-workspace.json",
"npm-workspace.yaml",
"yarn-workspace.yaml",
"pnpm-workspace.yaml",
"npm-workspace.yml",
"yarn-workspace.yml",
"pnpm-workspace.yml",
"npm-lock.json",
"yarn-lock.json",
"pnpm-lock.json",
"npm-lock.yaml",
"yarn-lock.yaml",
"pnpm-lock.yaml",
"npm-lock.yml",
"yarn-lock.yml",
"pnpm-lock.yml",
"bun.lockb"
];
var rootDirectories = [
".storm-workspace",
".nx",
".git",
".github",
".vscode",
".verdaccio"
];
function findWorkspaceRootSafe(pathInsideMonorepo) {
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
return _chunkBDATZ3UBcjs.correctPaths.call(void 0,
_nullishCoalesce(process.env.STORM_WORKSPACE_ROOT, () => ( process.env.NX_WORKSPACE_ROOT_PATH))
);
}
return _chunkBDATZ3UBcjs.correctPaths.call(void 0,
_chunkNJFLUTGHcjs.findFolderUp.call(void 0,
_nullishCoalesce(pathInsideMonorepo, () => ( process.cwd())),
rootFiles,
rootDirectories
)
);
}
function findWorkspaceRoot(pathInsideMonorepo) {
const result = findWorkspaceRootSafe(pathInsideMonorepo);
if (!result) {
throw new Error(
`Cannot find workspace root upwards from known path. Files search list includes:
${rootFiles.join(
"\n"
)}
Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
);
}
return result;
}
exports.findWorkspaceRootSafe = findWorkspaceRootSafe; exports.findWorkspaceRoot = findWorkspaceRoot;
"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; }
var _chunk3CNCDDWZcjs = require('./chunk-3CNCDDWZ.cjs');
var _chunkBDATZ3UBcjs = require('./chunk-BDATZ3UB.cjs');
// src/utilities/get-default-config.ts
var _config = require('@storm-software/config');
var _fs = require('fs');
var _promises = require('fs/promises');
var _path = require('path');
async function getPackageJsonConfig(root) {
let license = _config.STORM_DEFAULT_LICENSE;
let homepage = void 0;
let support = void 0;
let name = void 0;
let namespace = void 0;
let repository = void 0;
const workspaceRoot = _chunk3CNCDDWZcjs.findWorkspaceRoot.call(void 0, root);
if (_fs.existsSync.call(void 0, _path.join.call(void 0, workspaceRoot, "package.json"))) {
const file = await _promises.readFile.call(void 0,
_chunkBDATZ3UBcjs.joinPaths.call(void 0, workspaceRoot, "package.json"),
"utf8"
);
if (file) {
const packageJson = JSON.parse(file);
if (packageJson.name) {
name = packageJson.name;
}
if (packageJson.namespace) {
namespace = packageJson.namespace;
}
if (packageJson.repository) {
if (typeof packageJson.repository === "string") {
repository = packageJson.repository;
} else if (packageJson.repository.url) {
repository = packageJson.repository.url;
}
}
if (packageJson.license) {
license = packageJson.license;
}
if (packageJson.homepage) {
homepage = packageJson.homepage;
}
if (packageJson.bugs) {
if (typeof packageJson.bugs === "string") {
support = packageJson.bugs;
} else if (packageJson.bugs.url) {
support = packageJson.bugs.url;
}
}
}
}
return {
workspaceRoot,
name,
namespace,
repository,
license,
homepage,
support
};
}
function applyDefaultConfig(config) {
if (!config.support && config.contact) {
config.support = config.contact;
}
if (!config.contact && config.support) {
config.contact = config.support;
}
if (config.homepage) {
if (!config.docs) {
config.docs = `${config.homepage}/docs`;
}
if (!config.license) {
config.license = `${config.homepage}/license`;
}
if (!config.support) {
config.support = `${config.homepage}/support`;
}
if (!config.contact) {
config.contact = `${config.homepage}/contact`;
}
if (!_optionalChain([config, 'access', _ => _.error, 'optionalAccess', _2 => _2.codesFile]) || !_optionalChain([config, 'optionalAccess', _3 => _3.error, 'optionalAccess', _4 => _4.url])) {
config.error ??= { codesFile: _config.STORM_DEFAULT_ERROR_CODES_FILE };
if (config.homepage) {
config.error.url ??= `${config.homepage}/errors`;
}
}
}
return config;
}
exports.getPackageJsonConfig = getPackageJsonConfig; exports.applyDefaultConfig = applyDefaultConfig;
"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; }
var _chunk3CNCDDWZcjs = require('./chunk-3CNCDDWZ.cjs');
// src/utilities/apply-workspace-tokens.ts
var applyWorkspaceBaseTokens = async (option, tokenParams) => {
let result = option;
if (!result) {
return result;
}
if (tokenParams) {
const optionKeys = Object.keys(tokenParams);
if (optionKeys.some((optionKey) => result.includes(`{${optionKey}}`))) {
for (const optionKey of optionKeys) {
if (result.includes(`{${optionKey}}`)) {
result = result.replaceAll(
`{${optionKey}}`,
_optionalChain([tokenParams, 'optionalAccess', _ => _[optionKey]]) || ""
);
}
}
}
}
if (tokenParams.config) {
const configKeys = Object.keys(tokenParams.config);
if (configKeys.some((configKey) => result.includes(`{${configKey}}`))) {
for (const configKey of configKeys) {
if (result.includes(`{${configKey}}`)) {
result = result.replaceAll(
`{${configKey}}`,
tokenParams.config[configKey] || ""
);
}
}
}
}
if (result.includes("{workspaceRoot}")) {
result = result.replaceAll(
"{workspaceRoot}",
_nullishCoalesce(_nullishCoalesce(tokenParams.workspaceRoot, () => ( _optionalChain([tokenParams, 'access', _2 => _2.config, 'optionalAccess', _3 => _3.workspaceRoot]))), () => ( _chunk3CNCDDWZcjs.findWorkspaceRoot.call(void 0, )))
);
}
return result;
};
var applyWorkspaceProjectTokens = (option, tokenParams) => {
return applyWorkspaceBaseTokens(option, tokenParams);
};
var applyWorkspaceTokens = async (options, tokenParams, tokenizerFn) => {
if (!options) {
return {};
}
const result = {};
for (const option of Object.keys(options)) {
if (typeof options[option] === "string") {
result[option] = await Promise.resolve(
tokenizerFn(options[option], tokenParams)
);
} else if (Array.isArray(options[option])) {
result[option] = await Promise.all(
options[option].map(
async (item) => typeof item === "string" ? await Promise.resolve(tokenizerFn(item, tokenParams)) : item
)
);
} else if (typeof options[option] === "object") {
result[option] = await applyWorkspaceTokens(
options[option],
tokenParams,
tokenizerFn
);
} else {
result[option] = options[option];
}
}
return result;
};
exports.applyWorkspaceBaseTokens = applyWorkspaceBaseTokens; exports.applyWorkspaceProjectTokens = applyWorkspaceProjectTokens; exports.applyWorkspaceTokens = applyWorkspaceTokens;
"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; }
var _chunk3CNCDDWZcjs = require('./chunk-3CNCDDWZ.cjs');
var _chunkTZZRLM5Jcjs = require('./chunk-TZZRLM5J.cjs');
var _chunkBDATZ3UBcjs = require('./chunk-BDATZ3UB.cjs');
// src/config-file/get-config-file.ts
var _c12 = require('c12');
var _defu = require('defu'); var _defu2 = _interopRequireDefault(_defu);
var getConfigFileByName = async (fileName, filePath, options = {}) => {
const workspacePath = filePath || _chunk3CNCDDWZcjs.findWorkspaceRoot.call(void 0, filePath);
const configs = await Promise.all([
_c12.loadConfig.call(void 0, {
cwd: workspacePath,
packageJson: true,
name: fileName,
envName: _optionalChain([fileName, 'optionalAccess', _ => _.toUpperCase, 'call', _2 => _2()]),
jitiOptions: {
debug: false,
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : _chunkBDATZ3UBcjs.joinPaths.call(void 0,
process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
"jiti"
)
},
...options
}),
_c12.loadConfig.call(void 0, {
cwd: workspacePath,
packageJson: true,
name: fileName,
envName: _optionalChain([fileName, 'optionalAccess', _3 => _3.toUpperCase, 'call', _4 => _4()]),
jitiOptions: {
debug: false,
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : _chunkBDATZ3UBcjs.joinPaths.call(void 0,
process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
"jiti"
)
},
configFile: fileName,
...options
})
]);
return _defu2.default.call(void 0, _nullishCoalesce(configs[0], () => ( {})), _nullishCoalesce(configs[1], () => ( {})));
};
var getConfigFile = async (filePath, additionalFileNames = []) => {
const workspacePath = filePath ? filePath : _chunk3CNCDDWZcjs.findWorkspaceRoot.call(void 0, filePath);
const result = await getConfigFileByName("storm-workspace", workspacePath);
let config = result.config;
const configFile = result.configFile;
if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) {
_chunkTZZRLM5Jcjs.writeTrace.call(void 0,
`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`,
{
logLevel: "all"
}
);
}
if (additionalFileNames && additionalFileNames.length > 0) {
const results = await Promise.all(
additionalFileNames.map(
(fileName) => getConfigFileByName(fileName, workspacePath)
)
);
for (const result2 of results) {
if (_optionalChain([result2, 'optionalAccess', _5 => _5.config]) && _optionalChain([result2, 'optionalAccess', _6 => _6.configFile]) && Object.keys(result2.config).length > 0) {
if (!config.skipConfigLogging && !result2.config.skipConfigLogging) {
_chunkTZZRLM5Jcjs.writeTrace.call(void 0,
`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`,
{
logLevel: "all"
}
);
}
config = _defu2.default.call(void 0, _nullishCoalesce(result2.config, () => ( {})), _nullishCoalesce(config, () => ( {})));
}
}
}
if (!config || Object.keys(config).length === 0) {
return void 0;
}
config.configFile = configFile;
return config;
};
exports.getConfigFileByName = getConfigFileByName; exports.getConfigFile = getConfigFile;
import {
findWorkspaceRoot
} from "./chunk-LF3SAK2O.js";
import {
writeTrace
} from "./chunk-D3FRXXDE.js";
import {
joinPaths
} from "./chunk-V3GMJ4TX.js";
// src/config-file/get-config-file.ts
import { loadConfig } from "c12";
import defu from "defu";
var getConfigFileByName = async (fileName, filePath, options = {}) => {
const workspacePath = filePath || findWorkspaceRoot(filePath);
const configs = await Promise.all([
loadConfig({
cwd: workspacePath,
packageJson: true,
name: fileName,
envName: fileName?.toUpperCase(),
jitiOptions: {
debug: false,
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
"jiti"
)
},
...options
}),
loadConfig({
cwd: workspacePath,
packageJson: true,
name: fileName,
envName: fileName?.toUpperCase(),
jitiOptions: {
debug: false,
fsCache: process.env.STORM_SKIP_CACHE === "true" ? false : joinPaths(
process.env.STORM_CACHE_DIR || "node_modules/.cache/storm",
"jiti"
)
},
configFile: fileName,
...options
})
]);
return defu(configs[0] ?? {}, configs[1] ?? {});
};
var getConfigFile = async (filePath, additionalFileNames = []) => {
const workspacePath = filePath ? filePath : findWorkspaceRoot(filePath);
const result = await getConfigFileByName("storm-workspace", workspacePath);
let config = result.config;
const configFile = result.configFile;
if (config && configFile && Object.keys(config).length > 0 && !config.skipConfigLogging) {
writeTrace(
`Found Storm configuration file "${configFile.includes(`${workspacePath}/`) ? configFile.replace(`${workspacePath}/`, "") : configFile}" at "${workspacePath}"`,
{
logLevel: "all"
}
);
}
if (additionalFileNames && additionalFileNames.length > 0) {
const results = await Promise.all(
additionalFileNames.map(
(fileName) => getConfigFileByName(fileName, workspacePath)
)
);
for (const result2 of results) {
if (result2?.config && result2?.configFile && Object.keys(result2.config).length > 0) {
if (!config.skipConfigLogging && !result2.config.skipConfigLogging) {
writeTrace(
`Found alternative configuration file "${result2.configFile.includes(`${workspacePath}/`) ? result2.configFile.replace(`${workspacePath}/`, "") : result2.configFile}" at "${workspacePath}"`,
{
logLevel: "all"
}
);
}
config = defu(result2.config ?? {}, config ?? {});
}
}
}
if (!config || Object.keys(config).length === 0) {
return void 0;
}
config.configFile = configFile;
return config;
};
export {
getConfigFileByName,
getConfigFile
};
import {
getConfigFile
} from "./chunk-IUVY5TOB.js";
import {
applyDefaultConfig,
getPackageJsonConfig
} from "./chunk-RGET2UQV.js";
import {
findWorkspaceRoot
} from "./chunk-LF3SAK2O.js";
import {
formatLogMessage,
writeTrace,
writeWarning
} from "./chunk-D3FRXXDE.js";
import {
setConfigEnv
} from "./chunk-FJNXECWU.js";
import {
getConfigEnv,
getExtensionEnv
} from "./chunk-2RLMTBVZ.js";
import {
joinPaths
} from "./chunk-V3GMJ4TX.js";
// src/create-storm-config.ts
import { workspaceConfigSchema } from "@storm-software/config/schema";
import defu from "defu";
import { existsSync } from "node:fs";
var _extension_cache = /* @__PURE__ */ new WeakMap();
var _static_cache = void 0;
var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
let result;
if (!_static_cache?.data || !_static_cache?.timestamp || _static_cache.timestamp < Date.now() - 8e3) {
let _workspaceRoot = workspaceRoot;
if (!_workspaceRoot) {
_workspaceRoot = findWorkspaceRoot();
}
const configEnv = getConfigEnv();
const configFile = await getConfigFile(_workspaceRoot);
if (!configFile) {
if (!skipLogs) {
writeWarning(
"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",
{ logLevel: "all" }
);
}
if (useDefault === false) {
return void 0;
}
}
const defaultConfig = await getPackageJsonConfig(_workspaceRoot);
const configInput = defu(
configEnv,
configFile,
defaultConfig
);
if (!configInput.variant) {
configInput.variant = existsSync(joinPaths(_workspaceRoot, "nx.json")) || existsSync(joinPaths(_workspaceRoot, ".nx")) || existsSync(joinPaths(_workspaceRoot, "lerna.json")) || existsSync(joinPaths(_workspaceRoot, "turbo.json")) ? "monorepo" : "minimal";
}
try {
const parseResult = await Promise.resolve(
workspaceConfigSchema._zod.parse(
{ value: configInput, issues: [] },
{ async: true }
)
);
result = applyDefaultConfig(parseResult.value);
result.workspaceRoot ??= _workspaceRoot;
} catch (error) {
throw new Error(
`Failed to parse Storm Workspace configuration${error?.message ? `: ${error.message}` : ""}
Please ensure your configuration file is valid JSON and matches the expected schema. The current workspace configuration input is: ${formatLogMessage(
configInput
)}`,
{
cause: error
}
);
}
} else {
result = _static_cache.data;
}
if (schema && extensionName) {
result.extensions = {
...result.extensions,
[extensionName]: createConfigExtension(extensionName, schema)
};
}
_static_cache = {
timestamp: Date.now(),
data: result
};
return result;
};
var createConfigExtension = (extensionName, schema) => {
const extension_cache_key = { extensionName };
if (_extension_cache.has(extension_cache_key)) {
return _extension_cache.get(extension_cache_key);
}
let extension = getExtensionEnv(extensionName);
if (schema) {
extension = schema.parse(extension);
}
_extension_cache.set(extension_cache_key, extension);
return extension;
};
var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
const config = await createStormWorkspaceConfig(
void 0,
void 0,
workspaceRoot,
skipLogs,
true
);
setConfigEnv(config);
if (!skipLogs && !config.skipConfigLogging) {
writeTrace(
`\u2699\uFE0F Using Storm Workspace configuration:
${formatLogMessage(config)}`,
config
);
}
return config;
};
var tryLoadStormWorkspaceConfig = async (workspaceRoot, skipLogs = true, useDefault = false) => {
try {
const config = await createStormWorkspaceConfig(
void 0,
void 0,
workspaceRoot,
skipLogs,
useDefault
);
if (!config) {
return void 0;
}
setConfigEnv(config);
if (!skipLogs && !config.skipConfigLogging) {
writeTrace(
`\u2699\uFE0F Using Storm Workspace configuration:
${formatLogMessage(config)}`,
config
);
}
return config;
} catch (error) {
if (!skipLogs) {
writeWarning(
`\u26A0\uFE0F Failed to load Storm Workspace configuration: ${error}`,
{ logLevel: "all" }
);
}
return void 0;
}
};
export {
createStormWorkspaceConfig,
createConfigExtension,
loadStormWorkspaceConfig,
tryLoadStormWorkspaceConfig
};
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
var _chunkTX2VIMVXcjs = require('./chunk-TX2VIMVX.cjs');
var _chunk3CNCDDWZcjs = require('./chunk-3CNCDDWZ.cjs');
// src/get-config.ts
function getConfig(workspaceRoot, skipLogs = false) {
return _chunkTX2VIMVXcjs.loadStormWorkspaceConfig.call(void 0, workspaceRoot, skipLogs);
}
function getWorkspaceConfig(skipLogs = true, options = {}) {
let workspaceRoot = options.workspaceRoot;
if (!workspaceRoot) {
workspaceRoot = _chunk3CNCDDWZcjs.findWorkspaceRoot.call(void 0, options.cwd);
}
return getConfig(workspaceRoot, skipLogs);
}
async function tryGetWorkspaceConfig(skipLogs = true, options = {}) {
try {
let workspaceRoot = options.workspaceRoot;
if (!workspaceRoot) {
workspaceRoot = _chunk3CNCDDWZcjs.findWorkspaceRoot.call(void 0, options.cwd);
}
return _chunkTX2VIMVXcjs.tryLoadStormWorkspaceConfig.call(void 0,
workspaceRoot,
skipLogs,
options.useDefault
);
} catch (e) {
return void 0;
}
}
exports.getConfig = getConfig; exports.getWorkspaceConfig = getWorkspaceConfig; exports.tryGetWorkspaceConfig = tryGetWorkspaceConfig;
import {
findFolderUp
} from "./chunk-RUKM6FCF.js";
import {
correctPaths
} from "./chunk-V3GMJ4TX.js";
// src/utilities/find-workspace-root.ts
var rootFiles = [
"storm-workspace.json",
"storm-workspace.yaml",
"storm-workspace.yml",
"storm-workspace.js",
"storm-workspace.ts",
".storm-workspace.json",
".storm-workspace.yaml",
".storm-workspace.yml",
".storm-workspace.js",
".storm-workspace.ts",
"lerna.json",
"nx.json",
"turbo.json",
"npm-workspace.json",
"yarn-workspace.json",
"pnpm-workspace.json",
"npm-workspace.yaml",
"yarn-workspace.yaml",
"pnpm-workspace.yaml",
"npm-workspace.yml",
"yarn-workspace.yml",
"pnpm-workspace.yml",
"npm-lock.json",
"yarn-lock.json",
"pnpm-lock.json",
"npm-lock.yaml",
"yarn-lock.yaml",
"pnpm-lock.yaml",
"npm-lock.yml",
"yarn-lock.yml",
"pnpm-lock.yml",
"bun.lockb"
];
var rootDirectories = [
".storm-workspace",
".nx",
".git",
".github",
".vscode",
".verdaccio"
];
function findWorkspaceRootSafe(pathInsideMonorepo) {
if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
return correctPaths(
process.env.STORM_WORKSPACE_ROOT ?? process.env.NX_WORKSPACE_ROOT_PATH
);
}
return correctPaths(
findFolderUp(
pathInsideMonorepo ?? process.cwd(),
rootFiles,
rootDirectories
)
);
}
function findWorkspaceRoot(pathInsideMonorepo) {
const result = findWorkspaceRootSafe(pathInsideMonorepo);
if (!result) {
throw new Error(
`Cannot find workspace root upwards from known path. Files search list includes:
${rootFiles.join(
"\n"
)}
Path: ${pathInsideMonorepo ? pathInsideMonorepo : process.cwd()}`
);
}
return result;
}
export {
findWorkspaceRootSafe,
findWorkspaceRoot
};
import {
findWorkspaceRoot
} from "./chunk-LF3SAK2O.js";
import {
joinPaths
} from "./chunk-V3GMJ4TX.js";
// src/utilities/get-default-config.ts
import {
STORM_DEFAULT_ERROR_CODES_FILE,
STORM_DEFAULT_LICENSE
} from "@storm-software/config";
import { existsSync } from "node:fs";
import { readFile } from "node:fs/promises";
import { join } from "node:path";
async function getPackageJsonConfig(root) {
let license = STORM_DEFAULT_LICENSE;
let homepage = void 0;
let support = void 0;
let name = void 0;
let namespace = void 0;
let repository = void 0;
const workspaceRoot = findWorkspaceRoot(root);
if (existsSync(join(workspaceRoot, "package.json"))) {
const file = await readFile(
joinPaths(workspaceRoot, "package.json"),
"utf8"
);
if (file) {
const packageJson = JSON.parse(file);
if (packageJson.name) {
name = packageJson.name;
}
if (packageJson.namespace) {
namespace = packageJson.namespace;
}
if (packageJson.repository) {
if (typeof packageJson.repository === "string") {
repository = packageJson.repository;
} else if (packageJson.repository.url) {
repository = packageJson.repository.url;
}
}
if (packageJson.license) {
license = packageJson.license;
}
if (packageJson.homepage) {
homepage = packageJson.homepage;
}
if (packageJson.bugs) {
if (typeof packageJson.bugs === "string") {
support = packageJson.bugs;
} else if (packageJson.bugs.url) {
support = packageJson.bugs.url;
}
}
}
}
return {
workspaceRoot,
name,
namespace,
repository,
license,
homepage,
support
};
}
function applyDefaultConfig(config) {
if (!config.support && config.contact) {
config.support = config.contact;
}
if (!config.contact && config.support) {
config.contact = config.support;
}
if (config.homepage) {
if (!config.docs) {
config.docs = `${config.homepage}/docs`;
}
if (!config.license) {
config.license = `${config.homepage}/license`;
}
if (!config.support) {
config.support = `${config.homepage}/support`;
}
if (!config.contact) {
config.contact = `${config.homepage}/contact`;
}
if (!config.error?.codesFile || !config?.error?.url) {
config.error ??= { codesFile: STORM_DEFAULT_ERROR_CODES_FILE };
if (config.homepage) {
config.error.url ??= `${config.homepage}/errors`;
}
}
}
return config;
}
export {
getPackageJsonConfig,
applyDefaultConfig
};
"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; }
var _chunkIJBWQJQWcjs = require('./chunk-IJBWQJQW.cjs');
var _chunkCFXT4ZAWcjs = require('./chunk-CFXT4ZAW.cjs');
var _chunk3CNCDDWZcjs = require('./chunk-3CNCDDWZ.cjs');
var _chunkTZZRLM5Jcjs = require('./chunk-TZZRLM5J.cjs');
var _chunkBZRTSWH4cjs = require('./chunk-BZRTSWH4.cjs');
var _chunkUJ77IBHDcjs = require('./chunk-UJ77IBHD.cjs');
var _chunkBDATZ3UBcjs = require('./chunk-BDATZ3UB.cjs');
// src/create-storm-config.ts
var _schema = require('@storm-software/config/schema');
var _defu = require('defu'); var _defu2 = _interopRequireDefault(_defu);
var _fs = require('fs');
var _extension_cache = /* @__PURE__ */ new WeakMap();
var _static_cache = void 0;
var createStormWorkspaceConfig = async (extensionName, schema, workspaceRoot, skipLogs = false, useDefault = true) => {
let result;
if (!_optionalChain([_static_cache, 'optionalAccess', _ => _.data]) || !_optionalChain([_static_cache, 'optionalAccess', _2 => _2.timestamp]) || _static_cache.timestamp < Date.now() - 8e3) {
let _workspaceRoot = workspaceRoot;
if (!_workspaceRoot) {
_workspaceRoot = _chunk3CNCDDWZcjs.findWorkspaceRoot.call(void 0, );
}
const configEnv = _chunkUJ77IBHDcjs.getConfigEnv.call(void 0, );
const configFile = await _chunkIJBWQJQWcjs.getConfigFile.call(void 0, _workspaceRoot);
if (!configFile) {
if (!skipLogs) {
_chunkTZZRLM5Jcjs.writeWarning.call(void 0,
"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",
{ logLevel: "all" }
);
}
if (useDefault === false) {
return void 0;
}
}
const defaultConfig = await _chunkCFXT4ZAWcjs.getPackageJsonConfig.call(void 0, _workspaceRoot);
const configInput = _defu2.default.call(void 0,
configEnv,
configFile,
defaultConfig
);
if (!configInput.variant) {
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";
}
try {
const parseResult = await Promise.resolve(
_schema.workspaceConfigSchema._zod.parse(
{ value: configInput, issues: [] },
{ async: true }
)
);
result = _chunkCFXT4ZAWcjs.applyDefaultConfig.call(void 0, parseResult.value);
result.workspaceRoot ??= _workspaceRoot;
} catch (error) {
throw new Error(
`Failed to parse Storm Workspace configuration${_optionalChain([error, 'optionalAccess', _3 => _3.message]) ? `: ${error.message}` : ""}
Please ensure your configuration file is valid JSON and matches the expected schema. The current workspace configuration input is: ${_chunkTZZRLM5Jcjs.formatLogMessage.call(void 0,
configInput
)}`,
{
cause: error
}
);
}
} else {
result = _static_cache.data;
}
if (schema && extensionName) {
result.extensions = {
...result.extensions,
[extensionName]: createConfigExtension(extensionName, schema)
};
}
_static_cache = {
timestamp: Date.now(),
data: result
};
return result;
};
var createConfigExtension = (extensionName, schema) => {
const extension_cache_key = { extensionName };
if (_extension_cache.has(extension_cache_key)) {
return _extension_cache.get(extension_cache_key);
}
let extension = _chunkUJ77IBHDcjs.getExtensionEnv.call(void 0, extensionName);
if (schema) {
extension = schema.parse(extension);
}
_extension_cache.set(extension_cache_key, extension);
return extension;
};
var loadStormWorkspaceConfig = async (workspaceRoot, skipLogs = false) => {
const config = await createStormWorkspaceConfig(
void 0,
void 0,
workspaceRoot,
skipLogs,
true
);
_chunkBZRTSWH4cjs.setConfigEnv.call(void 0, config);
if (!skipLogs && !config.skipConfigLogging) {
_chunkTZZRLM5Jcjs.writeTrace.call(void 0,
`\u2699\uFE0F Using Storm Workspace configuration:
${_chunkTZZRLM5Jcjs.formatLogMessage.call(void 0, config)}`,
config
);
}
return config;
};
var tryLoadStormWorkspaceConfig = async (workspaceRoot, skipLogs = true, useDefault = false) => {
try {
const config = await createStormWorkspaceConfig(
void 0,
void 0,
workspaceRoot,
skipLogs,
useDefault
);
if (!config) {
return void 0;
}
_chunkBZRTSWH4cjs.setConfigEnv.call(void 0, config);
if (!skipLogs && !config.skipConfigLogging) {
_chunkTZZRLM5Jcjs.writeTrace.call(void 0,
`\u2699\uFE0F Using Storm Workspace configuration:
${_chunkTZZRLM5Jcjs.formatLogMessage.call(void 0, config)}`,
config
);
}
return config;
} catch (error) {
if (!skipLogs) {
_chunkTZZRLM5Jcjs.writeWarning.call(void 0,
`\u26A0\uFE0F Failed to load Storm Workspace configuration: ${error}`,
{ logLevel: "all" }
);
}
return void 0;
}
};
exports.createStormWorkspaceConfig = createStormWorkspaceConfig; exports.createConfigExtension = createConfigExtension; exports.loadStormWorkspaceConfig = loadStormWorkspaceConfig; exports.tryLoadStormWorkspaceConfig = tryLoadStormWorkspaceConfig;
import {
findWorkspaceRoot
} from "./chunk-LF3SAK2O.js";
// src/utilities/apply-workspace-tokens.ts
var applyWorkspaceBaseTokens = async (option, tokenParams) => {
let result = option;
if (!result) {
return result;
}
if (tokenParams) {
const optionKeys = Object.keys(tokenParams);
if (optionKeys.some((optionKey) => result.includes(`{${optionKey}}`))) {
for (const optionKey of optionKeys) {
if (result.includes(`{${optionKey}}`)) {
result = result.replaceAll(
`{${optionKey}}`,
tokenParams?.[optionKey] || ""
);
}
}
}
}
if (tokenParams.config) {
const configKeys = Object.keys(tokenParams.config);
if (configKeys.some((configKey) => result.includes(`{${configKey}}`))) {
for (const configKey of configKeys) {
if (result.includes(`{${configKey}}`)) {
result = result.replaceAll(
`{${configKey}}`,
tokenParams.config[configKey] || ""
);
}
}
}
}
if (result.includes("{workspaceRoot}")) {
result = result.replaceAll(
"{workspaceRoot}",
tokenParams.workspaceRoot ?? tokenParams.config?.workspaceRoot ?? findWorkspaceRoot()
);
}
return result;
};
var applyWorkspaceProjectTokens = (option, tokenParams) => {
return applyWorkspaceBaseTokens(option, tokenParams);
};
var applyWorkspaceTokens = async (options, tokenParams, tokenizerFn) => {
if (!options) {
return {};
}
const result = {};
for (const option of Object.keys(options)) {
if (typeof options[option] === "string") {
result[option] = await Promise.resolve(
tokenizerFn(options[option], tokenParams)
);
} else if (Array.isArray(options[option])) {
result[option] = await Promise.all(
options[option].map(
async (item) => typeof item === "string" ? await Promise.resolve(tokenizerFn(item, tokenParams)) : item
)
);
} else if (typeof options[option] === "object") {
result[option] = await applyWorkspaceTokens(
options[option],
tokenParams,
tokenizerFn
);
} else {
result[option] = options[option];
}
}
return result;
};
export {
applyWorkspaceBaseTokens,
applyWorkspaceProjectTokens,
applyWorkspaceTokens
};
import {
loadStormWorkspaceConfig,
tryLoadStormWorkspaceConfig
} from "./chunk-J777WNCU.js";
import {
findWorkspaceRoot
} from "./chunk-LF3SAK2O.js";
// src/get-config.ts
function getConfig(workspaceRoot, skipLogs = false) {
return loadStormWorkspaceConfig(workspaceRoot, skipLogs);
}
function getWorkspaceConfig(skipLogs = true, options = {}) {
let workspaceRoot = options.workspaceRoot;
if (!workspaceRoot) {
workspaceRoot = findWorkspaceRoot(options.cwd);
}
return getConfig(workspaceRoot, skipLogs);
}
async function tryGetWorkspaceConfig(skipLogs = true, options = {}) {
try {
let workspaceRoot = options.workspaceRoot;
if (!workspaceRoot) {
workspaceRoot = findWorkspaceRoot(options.cwd);
}
return tryLoadStormWorkspaceConfig(
workspaceRoot,
skipLogs,
options.useDefault
);
} catch {
return void 0;
}
}
export {
getConfig,
getWorkspaceConfig,
tryGetWorkspaceConfig
};