"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }

var _chunkAXVHALK5cjs = require('./chunk-AXVHALK5.cjs');


var _chunkWSHWZNKFcjs = require('./chunk-WSHWZNKF.cjs');



var _chunkSCFUDB74cjs = require('./chunk-SCFUDB74.cjs');

// src/utilities/find-workspace-root.ts
_chunkSCFUDB74cjs.init_cjs_shims.call(void 0, );
var rootFiles = [
  "storm.json",
  "storm.json",
  "storm.yaml",
  "storm.yml",
  "storm.js",
  "storm.ts",
  ".storm.json",
  ".storm.yaml",
  ".storm.yml",
  ".storm.js",
  ".storm.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"
];
function findWorkspaceRootSafe(pathInsideMonorepo) {
  if (process.env.STORM_WORKSPACE_ROOT || process.env.NX_WORKSPACE_ROOT_PATH) {
    return _chunkWSHWZNKFcjs.correctPaths.call(void 0, _nullishCoalesce(process.env.STORM_WORKSPACE_ROOT, () => ( process.env.NX_WORKSPACE_ROOT_PATH)));
  }
  return _chunkWSHWZNKFcjs.correctPaths.call(void 0, _chunkAXVHALK5cjs.findFolderUp.call(void 0, _nullishCoalesce(pathInsideMonorepo, () => ( process.cwd())), rootFiles));
}
_chunkSCFUDB74cjs.__name.call(void 0, findWorkspaceRootSafe, "findWorkspaceRootSafe");
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;
}
_chunkSCFUDB74cjs.__name.call(void 0, findWorkspaceRoot, "findWorkspaceRoot");




exports.findWorkspaceRootSafe = findWorkspaceRootSafe; exports.findWorkspaceRoot = findWorkspaceRoot;
