@visulima/cerebro 4.0.0 → 4.0.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## @visulima/cerebro [4.0.1](https://github.com/visulima/visulima/compare/@visulima/cerebro@4.0.0...@visulima/cerebro@4.0.1) (2026-10-24)
2
+
3
+ ### Bug Fixes
4
+
5
+ * **cerebro:** stop heap tuning from re-spawning in a loop ([#980](https://github.com/visulima/visulima/issues/980)) ([cce5555](https://github.com/visulima/visulima/commit/cce555505c57abd110a70a5b047f7f46dfd24800))
6
+
7
+ ### Miscellaneous Chores
8
+
9
+ * move the vis packages out to visulima/vis ([#975](https://github.com/visulima/visulima/issues/975)) ([558c24d](https://github.com/visulima/visulima/commit/558c24d2556e7773472d6adafc4908d68e932b35))
10
+
1
11
  ## @visulima/cerebro [4.0.0](https://github.com/visulima/visulima/compare/@visulima/cerebro@3.1.3...@visulima/cerebro@4.0.0) (2026-10-15)
2
12
 
3
13
  ### ⚠ BREAKING CHANGES
@@ -10,8 +10,8 @@ interface HeapTuningOptions {
10
10
  *
11
11
  * When tuning is needed, this function re-spawns the process with computed
12
12
  * V8 memory flags and **never returns** — the parent exits with the child's
13
- * exit code. When no tuning is needed (flags already set), it returns
14
- * immediately.
13
+ * exit code. When no tuning is needed (flags already set, the re-exec guard
14
+ * is set, or running as a single-executable application), it returns immediately.
15
15
  * @param options Optional configuration for heap tuning.
16
16
  */
17
17
  declare const applyHeapTuning: (options?: HeapTuningOptions) => void;
@@ -1 +1 @@
1
- import{createRequire as _}from"node:module";import{j as S,d as E,i as j,c as y,e as p}from"../../packem_shared/runtime-process-BLYbrTb0.js";let m;const h=e=>(m??=_(import.meta.url))(e),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,g=e=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[s,t]=r.versions.node.split(".").map(Number);if(s>22||s===22&&t>=3||s===20&&t>=16)return r.getBuiltinModule(e)}return h(e)},{execFileSync:v}=g("node:child_process"),{totalmem:x}=g("node:os"),A=/--max-old-space-size=(\d+)/,b=/--max-semi-space-size=(\d+)/,z=e=>Math.floor(x()/1024/1024*e),P=e=>e<=512?4:e<=1024?8:e<=2048?16:e<=4096?32:e<=8192?64:Math.floor(Math.log2(e))*8,f=(e,s)=>{for(const t of s){const o=e.exec(t);if(o)return Number.parseInt(o[1],10)}},M=e=>{const s=e?.maxOldSpacePercent??.75,t=[...S()],o=[...E()],c=f(A,t),i=f(b,t);if(c!==void 0&&i!==void 0)return;const a=c??z(s),l=i??P(a),n=[];if(c===void 0&&n.push(`--max-old-space-size=${String(a)}`),i===void 0&&n.push(`--max-semi-space-size=${String(l)}`),n.length!==0)try{v(j(),[...n,...t,...o.slice(1)],{env:y(),stdio:"inherit"}),p(0)}catch(d){const u=d.status;p(typeof u=="number"?u:1)}};export{M as applyHeapTuning};
1
+ import{createRequire as h}from"node:module";import{c as y,j as A,d as b,i as j,e as p}from"../../packem_shared/runtime-process-BLYbrTb0.js";let v;const x=e=>(v??=h(import.meta.url))(e),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,d=e=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[t,s]=o.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return o.getBuiltinModule(e)}return x(e)},{execFileSync:P}=d("node:child_process"),{totalmem:R}=d("node:os"),T=/--max-old-space-size=(\d+)/,z=/--max-semi-space-size=(\d+)/,a="CEREBRO_HEAP_TUNED",N=/\s+/,C=e=>Math.floor(R()/1024/1024*e),M=e=>e<=512?4:e<=1024?8:e<=2048?16:e<=4096?32:e<=8192?64:Math.floor(Math.log2(e))*8,q=()=>{try{return process.getBuiltinModule("node:sea")?.isSea?.()===!0}catch{return!1}},g=(e,t)=>{for(const s of t){const r=e.exec(s);if(r)return Number.parseInt(r[1],10)}},O=e=>{const t=y();if(q())return;if(t[a]==="1"){Reflect.deleteProperty(t,a);return}const s=e?.maxOldSpacePercent??.75,r=[...A()],_=[...b()],E=t.NODE_OPTIONS?.split(N)??[],u=[...r,...E],c=g(T,u),i=g(z,u);if(c!==void 0&&i!==void 0)return;const l=c??C(s),m=i??M(l),n=[];if(c===void 0&&n.push(`--max-old-space-size=${String(l)}`),i===void 0&&n.push(`--max-semi-space-size=${String(m)}`),n.length!==0)try{P(j(),[...n,...r,..._.slice(1)],{env:{...t,[a]:"1"},stdio:"inherit"}),p(0)}catch(S){const f=S.status;p(typeof f=="number"?f:1)}};export{O as applyHeapTuning};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@visulima/cerebro",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "A delightful toolkit for building cross-runtime CLIs for Node.js and Bun.",
5
5
  "keywords": [
6
6
  "ansi",