openmagic 0.41.1 → 0.41.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cli.js CHANGED
@@ -2859,6 +2859,10 @@ function checkDependenciesInstalled(cwd = process.cwd()) {
2859
2859
 
2860
2860
  // src/cli.ts
2861
2861
  import { createRequire as createRequire2 } from "module";
2862
+ try {
2863
+ execSync2("ulimit -n 65536", { shell: true, stdio: "ignore" });
2864
+ } catch {
2865
+ }
2862
2866
  var origEmitWarning = process.emitWarning;
2863
2867
  process.emitWarning = function(warning, ...args) {
2864
2868
  if (typeof warning === "string" && warning.includes("util._extend")) return;
@@ -2873,6 +2877,24 @@ process.on("uncaughtException", (err) => {
2873
2877
  console.error(chalk.dim(" Please report this at https://github.com/Kalmuraee/OpenMagic/issues"));
2874
2878
  process.exit(1);
2875
2879
  });
2880
+ try {
2881
+ const fdLimit = parseInt(execSync2("ulimit -n", { encoding: "utf-8", shell: true }).trim(), 10);
2882
+ if (fdLimit > 0 && fdLimit < 4096) {
2883
+ try {
2884
+ execSync2("ulimit -n 65536", { shell: true, stdio: "ignore" });
2885
+ } catch {
2886
+ }
2887
+ const newLimit = parseInt(execSync2("ulimit -n", { encoding: "utf-8", shell: true }).trim(), 10);
2888
+ if (newLimit < 4096) {
2889
+ console.log(chalk.yellow("\n \u26A0 File descriptor limit is " + fdLimit + " (need 4096+)."));
2890
+ console.log(chalk.dim(" This causes EMFILE errors in large Next.js/Turbopack projects."));
2891
+ console.log(chalk.dim(" Fix: add this to your ~/.zshrc (or ~/.bashrc):"));
2892
+ console.log(chalk.cyan(" ulimit -n 65536"));
2893
+ console.log(chalk.dim(" Then restart your terminal.\n"));
2894
+ }
2895
+ }
2896
+ } catch {
2897
+ }
2876
2898
  var childProcesses = [];
2877
2899
  var lastDetectedPort = null;
2878
2900
  var _require2 = createRequire2(import.meta.url);
@@ -3527,7 +3549,9 @@ async function offerToStartDevServer(expectedPort) {
3527
3549
  }
3528
3550
  let child;
3529
3551
  try {
3530
- child = spawn5(runCmd, runArgs, {
3552
+ const escapedArgs = runArgs.map((a) => `'${a.replace(/'/g, "'\\''")}'`).join(" ");
3553
+ const shellCmd = `ulimit -n 65536 2>/dev/null; exec ${runCmd} ${escapedArgs}`;
3554
+ child = spawn5("sh", ["-c", shellCmd], {
3531
3555
  cwd: process.cwd(),
3532
3556
  stdio: "inherit",
3533
3557
  env: {