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

var _chunk4AYNBMPPcjs = require('./chunk-4AYNBMPP.cjs');


var _chunkNXXPCLO3cjs = require('./chunk-NXXPCLO3.cjs');



var _chunkDFJNOFN2cjs = require('./chunk-DFJNOFN2.cjs');

// src/utilities/find-workspace-root.ts
_chunkDFJNOFN2cjs.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 _chunkNXXPCLO3cjs.correctPaths.call(void 0, _nullishCoalesce(process.env.STORM_WORKSPACE_ROOT, () => ( process.env.NX_WORKSPACE_ROOT_PATH)));
  }
  return _chunkNXXPCLO3cjs.correctPaths.call(void 0, _chunk4AYNBMPPcjs.findFolderUp.call(void 0, _nullishCoalesce(pathInsideMonorepo, () => ( process.cwd())), rootFiles));
}
_chunkDFJNOFN2cjs.__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;
}
_chunkDFJNOFN2cjs.__name.call(void 0, findWorkspaceRoot, "findWorkspaceRoot");




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