@teambit/isolator 1.0.1009 → 1.0.1010

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.
@@ -18,13 +18,12 @@ export type PruneCapsulesOptions = {
18
18
  olderThanDays?: number;
19
19
  includeOrphans?: boolean;
20
20
  keepWorkspaceCaps?: boolean;
21
- sizeTargetGb?: number;
22
21
  dryRun?: boolean;
23
22
  /**
24
23
  * Compute byte sizes for every entry being considered. When false, all `sizeBytes`
25
24
  * in the report are 0 and the cache walk skips the expensive recursive `lstat` pass —
26
25
  * deletion (rename-to-trash) is O(1) and runs in milliseconds even on multi-GB caches.
27
- * Forced on when `sizeTargetGb` is set because that path needs sizes to enforce.
26
+ * Opt-in (via `bit capsule prune --with-sizes`) since the walk is slow on large caches.
28
27
  */
29
28
  withSizes?: boolean;
30
29
  };
@@ -152,7 +151,6 @@ export declare class CapsuleCache {
152
151
  * - scope-aspects-root: never deleted as a whole; per-aspect-version children pruned by age
153
152
  * - scope caps and unmarked dirs older than threshold: deleted
154
153
  * - orphans (marker says originPath gone): deleted
155
- * - after the above, if sizeTargetGb given and size still exceeds it, evict oldest-first
156
154
  */
157
155
  pruneCapsules(opts?: PruneCapsulesOptions): Promise<PruneCapsulesReport>;
158
156
  /**
@@ -184,9 +182,4 @@ export declare class CapsuleCache {
184
182
  * Orphan pruning is still honored elsewhere for `workspace`/`scope` kinds.
185
183
  */
186
184
  private pruneAspectsRootChildren;
187
- /**
188
- * After the standard prune, if total still exceeds the target, keep evicting the
189
- * oldest remaining aspect-version subdirs until under the limit.
190
- */
191
- private applySizeTarget;
192
185
  }
@@ -257,11 +257,10 @@ class CapsuleCache {
257
257
  await _fsExtra().default.outputFile(stampPath, '');
258
258
 
259
259
  // Guard against non-numeric/empty config (NaN) and negative values (which would
260
- // invert the age cutoff / size target and wipe the whole cache).
260
+ // invert the age cutoff and wipe the whole cache).
261
261
  const olderThanDays = Math.max(0, toFiniteNumber(this.configStore.getConfig(_legacy().CFG_CAPSULES_MAX_AGE_DAYS)) ?? 30);
262
- const sizeTargetGb = Math.max(0, toFiniteNumber(this.configStore.getConfig(_legacy().CFG_CAPSULES_MAX_SIZE_GB)) ?? 10);
263
- this.logger.debug(`[auto-prune] spawning detached child. olderThanDays=${olderThanDays}, sizeTargetGb=${sizeTargetGb}`);
264
- this.spawnDetachedAutoPrune(olderThanDays, sizeTargetGb);
262
+ this.logger.debug(`[auto-prune] spawning detached child. olderThanDays=${olderThanDays}`);
263
+ this.spawnDetachedAutoPrune(olderThanDays);
265
264
  } finally {
266
265
  if (claimed) {
267
266
  try {
@@ -281,14 +280,14 @@ class CapsuleCache {
281
280
  * Recursion guard: the child also runs onBeforeExit → maybeAutoPrune, but it reads the
282
281
  * stamp file that we just wrote and bails out before re-spawning.
283
282
  */
284
- spawnDetachedAutoPrune(olderThanDays, sizeTargetGb) {
283
+ spawnDetachedAutoPrune(olderThanDays) {
285
284
  const bitEntry = process.argv[1];
286
285
  if (!bitEntry) {
287
286
  this.logger.debug('[auto-prune] cannot detach: process.argv[1] is empty');
288
287
  return;
289
288
  }
290
289
  try {
291
- const child = (0, _child_process().spawn)(process.execPath, [bitEntry, 'capsule', 'prune', '--older-than', String(olderThanDays), '--size-target', String(sizeTargetGb)], {
290
+ const child = (0, _child_process().spawn)(process.execPath, [bitEntry, 'capsule', 'prune', '--older-than', String(olderThanDays)], {
292
291
  detached: true,
293
292
  stdio: 'ignore',
294
293
  windowsHide: true
@@ -500,21 +499,18 @@ class CapsuleCache {
500
499
  * - scope-aspects-root: never deleted as a whole; per-aspect-version children pruned by age
501
500
  * - scope caps and unmarked dirs older than threshold: deleted
502
501
  * - orphans (marker says originPath gone): deleted
503
- * - after the above, if sizeTargetGb given and size still exceeds it, evict oldest-first
504
502
  */
505
503
  async pruneCapsules(opts = {}) {
506
504
  // Clamp to >= 0: a negative age would put the cutoff in the future (everything looks
507
- // "too old" → whole cache deleted); a negative size target would force evicting
508
- // everything. Both are almost certainly user error, so floor them at 0.
505
+ // "too old" → whole cache deleted), almost certainly user error, so floor it at 0.
509
506
  const olderThanDays = Math.max(0, opts.olderThanDays ?? 30);
510
- const sizeTargetGb = opts.sizeTargetGb === undefined ? undefined : Math.max(0, opts.sizeTargetGb);
511
507
  const includeOrphans = opts.includeOrphans !== false;
512
508
  const keepWorkspaceCaps = opts.keepWorkspaceCaps === true;
513
509
  const dryRun = opts.dryRun === true;
514
510
  // Size accounting requires an expensive recursive lstat across the whole cache. Skip
515
- // it by default so the foreground command returns in ms (deletes are O(1) renames);
516
- // force on for size-target enforcement and when the caller asks for byte accounting.
517
- const computeSizes = opts.withSizes === true || sizeTargetGb !== undefined;
511
+ // it by default so the command returns in ms (deletes are O(1) renames); opt in via
512
+ // `--with-sizes` when you want byte totals in the report.
513
+ const computeSizes = opts.withSizes === true;
518
514
  const ageCutoffMs = Date.now() - olderThanDays * ONE_DAY_MS;
519
515
  const datedDirName = this.configStore.getConfig(_legacy().CFG_CAPSULES_SCOPES_ASPECTS_DATED_DIR) || 'dated-capsules';
520
516
  const roots = await this.listAllCapsuleRoots({
@@ -559,9 +555,6 @@ class CapsuleCache {
559
555
  continue;
560
556
  }
561
557
  }
562
- if (sizeTargetGb !== undefined) {
563
- await this.applySizeTarget(sizeTargetGb, removed, dryRun);
564
- }
565
558
  const totalRemovedBytes = removed.reduce((sum, r) => sum + r.sizeBytes, 0);
566
559
  // For dry-run, report the *projected* post-prune size so the CLI summary stays
567
560
  // internally consistent (cache: X → X − freed). Real prune subtracts the same.
@@ -669,64 +662,6 @@ class CapsuleCache {
669
662
  }
670
663
  }
671
664
  }
672
-
673
- /**
674
- * After the standard prune, if total still exceeds the target, keep evicting the
675
- * oldest remaining aspect-version subdirs until under the limit.
676
- */
677
- async applySizeTarget(sizeTargetGb, removed, dryRun) {
678
- const targetBytes = sizeTargetGb * 1024 * 1024 * 1024;
679
- const removedPaths = new Set(removed.map(r => r.path));
680
- // Re-walk what's left (one pass, with sizes) to find both the current total and the
681
- // oldest aspect-version children to evict.
682
- const roots = await this.listAllCapsuleRoots();
683
- const totalBytes = roots.reduce((sum, r) => sum + r.sizeBytes, 0);
684
- const aspectChildren = [];
685
- for (const root of roots) {
686
- if (root.kind !== 'scope-aspects-root' && !(root.kind === 'unmarked' && (await this.looksLikeAspectsRoot(root.path)))) {
687
- continue;
688
- }
689
- let entries = [];
690
- try {
691
- entries = await _fsExtra().default.readdir(root.path, {
692
- withFileTypes: true
693
- });
694
- } catch {
695
- continue;
696
- }
697
- for (const entry of entries) {
698
- if (!this.isPrunableSubdir(entry)) continue;
699
- const childPath = _path().default.join(root.path, entry.name);
700
- if (removedPaths.has(childPath)) continue;
701
- const {
702
- marker,
703
- lastUsedMs
704
- } = await this.readMarkerInfo(childPath);
705
- const sizeBytes = await this.computeDirSize(childPath);
706
- aspectChildren.push({
707
- path: childPath,
708
- lastUsedMs,
709
- sizeBytes,
710
- originPath: marker?.originPath
711
- });
712
- }
713
- }
714
- aspectChildren.sort((a, b) => a.lastUsedMs - b.lastUsedMs);
715
- // In dry-run the standard-prune entries are still on disk (counted in totalBytes), so
716
- // subtract them; in a real run they were already moved to trash and excluded from the walk.
717
- let remainingBytes = totalBytes - (dryRun ? removed.reduce((s, r) => s + r.sizeBytes, 0) : 0);
718
- for (const child of aspectChildren) {
719
- if (remainingBytes <= targetBytes) break;
720
- await this.recordRemoval(removed, {
721
- path: child.path,
722
- kind: 'scope-aspect',
723
- reason: `size-target-${sizeTargetGb}gb`,
724
- sizeBytes: child.sizeBytes,
725
- originPath: child.originPath
726
- }, dryRun);
727
- remainingBytes -= child.sizeBytes;
728
- }
729
- }
730
665
  }
731
666
  exports.CapsuleCache = CapsuleCache;
732
667
 
@@ -1 +1 @@
1
- {"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_uuid","_path","_child_process","_pMap","_harmonyModules","_harmonyModules2","_legacy","e","__esModule","default","CAPSULE_ORIGIN_FILE","exports","CAPSULE_TRASH_DIR","ONE_DAY_MS","VALID_CAPSULE_KINDS","Set","toFiniteNumber","value","undefined","n","Number","isFinite","CapsuleCache","constructor","logger","cli","configStore","getRootDir","deleteCapsules","rootDir","dirToDelete","marker","readOriginMarker","debug","originPath","scheduleFastDelete","dir","exists","fs","pathExists","globalRoot","path","resolve","remove","trashRoot","join","ensureDir","trashTarget","basename","v4","move","overwrite","err","message","sweepTrashAsync","existsSync","lockPath","isSweepLockActive","writeFileSync","String","process","pid","flag","spawnDetachedSweep","pidStr","readFileSync","trim","kill","registerAutoPruneHook","registerOnBeforeExit","maybeAutoPrune","isFeatureEnabled","CAPSULE_AUTO_PRUNE","enabled","getConfig","CFG_CAPSULES_AUTO_PRUNE","root","stampPath","isStampFresh","stat","Date","now","mtime","getTime","claimPath","claimed","close","open","claimStat","outputFile","olderThanDays","Math","max","CFG_CAPSULES_MAX_AGE_DAYS","sizeTargetGb","CFG_CAPSULES_MAX_SIZE_GB","spawnDetachedAutoPrune","bitEntry","argv","child","spawn","execPath","detached","stdio","windowsHide","unref","script","JSON","stringify","removeSync","ensureOriginMarker","kind","markerPath","utimes","createdAt","toISOString","outputJson","ensureAspectCapsuleMarkers","capsuleList","rootOriginPath","Promise","all","map","capsule","getDatedCapsuleDirName","date","getFullYear","getMonth","getDate","isPrunableSubdir","entry","isDirectory","name","startsWith","readMarkerInfo","getOriginMarkerMtime","lastUsedMs","catch","raw","readJson","has","listAllCapsuleRoots","opts","withSizes","entries","readdir","withFileTypes","subdirs","filter","pMap","subPath","sizeBytes","computeDirSize","concurrency","concurrentIOLimit","total","walk","current","p","isFile","st","lstat","size","pruneCapsules","includeOrphans","keepWorkspaceCaps","dryRun","computeSizes","ageCutoffMs","datedDirName","CFG_CAPSULES_SCOPES_ASPECTS_DATED_DIR","roots","totalSizeBefore","reduce","sum","r","removed","removeEntry","reason","recordRemoval","pruneDatedCapsulesChildren","orphan","tooOld","looksLikeAspectsRoot","pruneAspectsRootChildren","applySizeTarget","totalRemovedBytes","totalSizeAfter","totalSizeBeforeBytes","totalSizeAfterBytes","push","rootPath","todayDir","childPath","some","includes","targetBytes","removedPaths","totalBytes","aspectChildren","sort","a","b","remainingBytes","s"],"sources":["capsule-cache.ts"],"sourcesContent":["/**\n * Manages the global capsules cache: origin markers, fast-delete + trash sweep, and the\n * prune pipeline (manual `bit capsule prune` and the gated auto-prune trigger).\n *\n * Owned by `IsolatorMain` but operationally independent — the isolator constructs an\n * instance, registers its hooks, and delegates the externally-visible cache-management\n * methods (`deleteCapsules`, `pruneCapsules`, `listAllCapsuleRoots`) to it. Keeps\n * `isolator.main.runtime.ts` focused on creating isolated component environments rather\n * than also being responsible for evicting them.\n */\nimport fs from 'fs-extra';\nimport { v4 } from 'uuid';\nimport path from 'path';\nimport { spawn } from 'child_process';\nimport pMap from 'p-map';\nimport type { Logger } from '@teambit/logger';\nimport type { CLIMain } from '@teambit/cli';\nimport type { ConfigStoreMain } from '@teambit/config-store';\nimport { concurrentIOLimit } from '@teambit/harmony.modules.concurrency';\nimport { isFeatureEnabled, CAPSULE_AUTO_PRUNE } from '@teambit/harmony.modules.feature-toggle';\nimport {\n CFG_CAPSULES_AUTO_PRUNE,\n CFG_CAPSULES_MAX_AGE_DAYS,\n CFG_CAPSULES_MAX_SIZE_GB,\n CFG_CAPSULES_SCOPES_ASPECTS_DATED_DIR,\n} from '@teambit/legacy.constants';\nimport type CapsuleList from './capsule-list';\n\n/**\n * Marker file written into every capsule dir we manage. Its presence tells the prune logic\n * what kind of dir this is, where it came from, and (via its mtime) when it was last used.\n */\nexport const CAPSULE_ORIGIN_FILE = '.bit-capsule-origin.json';\nexport const CAPSULE_TRASH_DIR = '.trash';\n\nconst ONE_DAY_MS = 24 * 60 * 60 * 1000;\n\nexport type CapsuleKind = 'workspace' | 'scope-aspects-root' | 'scope-aspect' | 'scope';\n\nconst VALID_CAPSULE_KINDS: ReadonlySet<string> = new Set(['workspace', 'scope-aspects-root', 'scope-aspect', 'scope']);\n\nexport type CapsuleOriginMarker = {\n originPath: string;\n createdAt: string;\n kind: CapsuleKind;\n};\n\nexport type PruneCapsulesOptions = {\n olderThanDays?: number;\n includeOrphans?: boolean;\n keepWorkspaceCaps?: boolean;\n sizeTargetGb?: number;\n dryRun?: boolean;\n /**\n * Compute byte sizes for every entry being considered. When false, all `sizeBytes`\n * in the report are 0 and the cache walk skips the expensive recursive `lstat` pass —\n * deletion (rename-to-trash) is O(1) and runs in milliseconds even on multi-GB caches.\n * Forced on when `sizeTargetGb` is set because that path needs sizes to enforce.\n */\n withSizes?: boolean;\n};\n\nexport type PruneCapsulesReport = {\n /** `originPath` is the workspace/scope a capsule was created for (from its marker), when known. */\n removed: { path: string; kind: CapsuleKind | 'unmarked'; reason: string; sizeBytes: number; originPath?: string }[];\n totalRemovedBytes: number;\n totalSizeBeforeBytes: number;\n totalSizeAfterBytes: number;\n dryRun: boolean;\n};\n\nexport type CapsuleRootEntry = {\n path: string;\n kind: CapsuleKind | 'unmarked';\n originPath?: string;\n lastUsedMs: number;\n sizeBytes: number;\n};\n\nfunction toFiniteNumber(value: unknown): number | undefined {\n if (value === undefined || value === null || value === '') return undefined;\n const n = Number(value);\n return Number.isFinite(n) ? n : undefined;\n}\n\nexport class CapsuleCache {\n constructor(\n private logger: Logger,\n private cli: CLIMain,\n private configStore: ConfigStoreMain,\n /** Thunk so the cache stays independent of `GlobalConfigMain` — IsolatorMain forwards it. */\n private getRootDir: () => string\n ) {}\n\n async deleteCapsules(rootDir?: string): Promise<string> {\n const dirToDelete = rootDir || this.getRootDir();\n const marker = await this.readOriginMarker(dirToDelete);\n this.logger.debug(\n `[capsule-delete] removing ${dirToDelete}` + (marker?.originPath ? ` origin=${marker.originPath}` : '')\n );\n await this.scheduleFastDelete(dirToDelete);\n return dirToDelete;\n }\n\n /**\n * Move a capsule dir into a sibling `.trash/<uuid>/` so it disappears from the cache\n * immediately (same-filesystem rename is O(1)), then kick off a detached `rm -rf` so the\n * actual byte-by-byte cleanup happens in the background. This avoids the multi-second\n * stalls users see when deleting capsules with thousands of files.\n */\n async scheduleFastDelete(dir: string): Promise<void> {\n const exists = await fs.pathExists(dir);\n if (!exists) return;\n const globalRoot = this.getRootDir();\n // Edge case: deleting the global root itself. We can't move a dir into its own\n // child (`.trash/...`), so just do a direct remove. This is rare — only `bit\n // capsule delete --all` hits it.\n if (path.resolve(dir) === path.resolve(globalRoot)) {\n await fs.remove(dir);\n return;\n }\n const trashRoot = path.join(globalRoot, CAPSULE_TRASH_DIR);\n await fs.ensureDir(trashRoot);\n const trashTarget = path.join(trashRoot, `${path.basename(dir)}-${v4()}`);\n try {\n await fs.move(dir, trashTarget, { overwrite: true });\n } catch (err: any) {\n // Likely cross-device — fall back to a synchronous remove.\n this.logger.debug(`scheduleFastDelete: rename failed for ${dir}, falling back to fs.remove (${err.message})`);\n await fs.remove(dir);\n return;\n }\n // Run through the gated sweepTrashAsync path so we never have more than one sweep\n // running concurrently — even if many bit processes are moving things to trash.\n this.sweepTrashAsync();\n }\n\n /**\n * Sweep the `.trash` dir in a detached background process. Gated by a PID-stamped\n * lock so we never have more than one sweep running at a time across all concurrent\n * bit processes — previously we spawned one per `bit` invocation and they piled up\n * into the thousands, saturating disk I/O.\n */\n sweepTrashAsync(): void {\n const trashRoot = path.join(this.getRootDir(), CAPSULE_TRASH_DIR);\n // No trash → nothing to do. Cheap synchronous check avoids spawning a process at all.\n if (!fs.existsSync(trashRoot)) return;\n const lockPath = path.join(this.getRootDir(), '.trash-sweep.lock');\n if (this.isSweepLockActive(lockPath)) {\n this.logger.debug(`trash sweep already running (per ${lockPath}), skipping`);\n return;\n }\n try {\n fs.writeFileSync(lockPath, String(process.pid), { flag: 'w' });\n } catch (err: any) {\n this.logger.debug(`failed to write sweep lock at ${lockPath}: ${err.message}`);\n return;\n }\n this.spawnDetachedSweep(trashRoot, lockPath);\n }\n\n /**\n * A sweep lock is \"active\" if the PID it names is still running. If the PID file\n * exists but the process is gone (e.g. crashed mid-sweep), we treat it as stale and\n * allow a new sweep to claim it.\n */\n private isSweepLockActive(lockPath: string): boolean {\n let pidStr: string;\n try {\n pidStr = fs.readFileSync(lockPath, 'utf8').trim();\n } catch {\n return false;\n }\n const pid = Number(pidStr);\n if (!Number.isFinite(pid) || pid <= 0) return false;\n try {\n // Signal 0 = \"is this PID alive?\" — no actual signal sent.\n process.kill(pid, 0);\n return true;\n } catch {\n return false;\n }\n }\n\n /**\n * Register a process-exit hook that, at most once per ~24h, spawns a detached\n * `bit capsule prune` child so the actual work runs out-of-process and never delays\n * the parent's exit. Gated by the mtime of a stamp file under the capsules root so\n * concurrent Bit invocations can't all trigger it at once, and behind the\n * `capsule-auto-prune` feature flag while the behavior is being validated.\n */\n registerAutoPruneHook(): void {\n this.cli.registerOnBeforeExit(async () => {\n try {\n await this.maybeAutoPrune();\n } catch (err: any) {\n this.logger.debug(`auto-prune skipped due to error: ${err?.message ?? err}`);\n }\n });\n }\n\n private async maybeAutoPrune(): Promise<void> {\n // Experimental: the automatic prune only runs for users who opt in via the feature flag\n // (`BIT_FEATURES=capsule-auto-prune` or `bit config set features=capsule-auto-prune`).\n // Until it's promoted to GA, the default behavior is unchanged — capsules are never\n // auto-deleted. The manual `bit capsule prune` command is always available regardless.\n if (!isFeatureEnabled(CAPSULE_AUTO_PRUNE)) return;\n\n // configStore may surface this as either string `'false'` (from `bit config set`)\n // or boolean `false` (from a hand-edited JSON config) — accept both. This is a\n // secondary escape hatch for once the feature is GA and the flag is removed.\n const enabled = this.configStore.getConfig(CFG_CAPSULES_AUTO_PRUNE);\n if (enabled === 'false' || (enabled as unknown) === false) return;\n\n const root = this.getRootDir();\n if (!(await fs.pathExists(root))) return;\n\n const stampPath = path.join(root, '.last-capsule-prune');\n const isStampFresh = async (): Promise<boolean> => {\n try {\n const stat = await fs.stat(stampPath);\n return Date.now() - stat.mtime.getTime() < ONE_DAY_MS;\n } catch {\n return false; // missing — needs a prune\n }\n };\n // Fast path: stamp is recent, nothing to do (no contention here).\n if (await isStampFresh()) return;\n\n // Atomic claim: only one process across all concurrent bit invocations may win the\n // daily slot. `wx` is O_CREAT|O_EXCL — it throws if the lock already exists, so the\n // check-and-write below can't race. The lock is held only for the few ms it takes to\n // re-check the stamp and spawn the detached child, then removed in `finally`.\n const claimPath = `${stampPath}.claim`;\n let claimed = false;\n try {\n await fs.close(await fs.open(claimPath, 'wx'));\n claimed = true;\n } catch {\n // Another process is mid-claim, or a previous run leaked the lock. If it's stale\n // (older than the daily window), reclaim it by removing + re-opening with O_EXCL —\n // if two processes race the reclaim, only one's `wx` open succeeds and the other\n // yields. Otherwise yield.\n try {\n const claimStat = await fs.stat(claimPath);\n if (Date.now() - claimStat.mtime.getTime() < ONE_DAY_MS) return;\n await fs.remove(claimPath);\n await fs.close(await fs.open(claimPath, 'wx'));\n claimed = true;\n } catch {\n return;\n }\n }\n try {\n // Re-check under the lock: a process that just held it may have refreshed the stamp.\n if (await isStampFresh()) return;\n await fs.outputFile(stampPath, '');\n\n // Guard against non-numeric/empty config (NaN) and negative values (which would\n // invert the age cutoff / size target and wipe the whole cache).\n const olderThanDays = Math.max(0, toFiniteNumber(this.configStore.getConfig(CFG_CAPSULES_MAX_AGE_DAYS)) ?? 30);\n const sizeTargetGb = Math.max(0, toFiniteNumber(this.configStore.getConfig(CFG_CAPSULES_MAX_SIZE_GB)) ?? 10);\n\n this.logger.debug(\n `[auto-prune] spawning detached child. olderThanDays=${olderThanDays}, sizeTargetGb=${sizeTargetGb}`\n );\n this.spawnDetachedAutoPrune(olderThanDays, sizeTargetGb);\n } finally {\n if (claimed) {\n try {\n await fs.remove(claimPath);\n } catch {\n // ignore — a stale claim lock is reclaimed by the age check above\n }\n }\n }\n }\n\n /**\n * Fire-and-forget: spawn a detached child running `bit capsule prune`. Using the same\n * bit binary that's currently running (via process.argv[0] + argv[1]) so we don't depend\n * on PATH. stdio is ignored so nothing leaks to the user's terminal.\n *\n * Recursion guard: the child also runs onBeforeExit → maybeAutoPrune, but it reads the\n * stamp file that we just wrote and bails out before re-spawning.\n */\n private spawnDetachedAutoPrune(olderThanDays: number, sizeTargetGb: number): void {\n const bitEntry = process.argv[1];\n if (!bitEntry) {\n this.logger.debug('[auto-prune] cannot detach: process.argv[1] is empty');\n return;\n }\n try {\n const child = spawn(\n process.execPath,\n [bitEntry, 'capsule', 'prune', '--older-than', String(olderThanDays), '--size-target', String(sizeTargetGb)],\n {\n detached: true,\n stdio: 'ignore',\n windowsHide: true,\n }\n );\n child.unref();\n } catch (err: any) {\n this.logger.debug(`[auto-prune] failed to spawn detached child: ${err.message}`);\n }\n }\n\n /**\n * Spawn one detached Node process that recursively removes `trashRoot`. Using\n * `process.execPath` with an inline `fs.rmSync` keeps this portable across macOS,\n * Linux, and Windows (where there's no `rm` binary). When `lockPath` is given, the\n * child clears the lock on exit so the next bit invocation can claim a fresh sweep slot.\n */\n private spawnDetachedSweep(trashRoot: string, lockPath?: string): void {\n const script = lockPath\n ? `try { require('fs').rmSync(${JSON.stringify(trashRoot)}, { recursive: true, force: true }); } finally { try { require('fs').rmSync(${JSON.stringify(lockPath)}, { force: true }); } catch (_) {} }`\n : `require('fs').rmSync(${JSON.stringify(trashRoot)}, { recursive: true, force: true })`;\n try {\n const child = spawn(process.execPath, ['-e', script], {\n detached: true,\n stdio: 'ignore',\n windowsHide: true,\n });\n child.unref();\n } catch (err: any) {\n this.logger.debug(`failed to spawn detached trash sweep: ${err.message}`);\n // Don't leak the lock if the spawn itself failed. Use fs-extra's removeSync\n // (rmSync isn't in the @types/fs-extra version pinned by this component).\n if (lockPath) {\n try {\n fs.removeSync(lockPath);\n } catch {\n // ignore\n }\n }\n }\n }\n\n /**\n * Write the origin marker if missing; otherwise just bump its mtime so it reflects\n * \"last used at\". Failures are non-fatal — markers are best-effort metadata.\n */\n async ensureOriginMarker(dir: string, kind: CapsuleKind, originPath: string): Promise<void> {\n const markerPath = path.join(dir, CAPSULE_ORIGIN_FILE);\n try {\n if (await fs.pathExists(markerPath)) {\n const now = new Date();\n await fs.utimes(markerPath, now, now);\n return;\n }\n const marker: CapsuleOriginMarker = {\n originPath,\n createdAt: new Date().toISOString(),\n kind,\n };\n await fs.outputJson(markerPath, marker);\n } catch (err: any) {\n this.logger.debug(`failed to write capsule origin marker at ${markerPath}: ${err.message}`);\n }\n }\n\n /**\n * Mark all per-component capsule subdirs as scope-aspect kind, originated from the\n * scope-aspects root. Used right after a scope-aspects isolation.\n */\n async ensureAspectCapsuleMarkers(capsuleList: CapsuleList, rootOriginPath: string): Promise<void> {\n await Promise.all(\n capsuleList.map(async (capsule) => {\n if (!fs.existsSync(capsule.path)) return;\n await this.ensureOriginMarker(capsule.path, 'scope-aspect', rootOriginPath);\n })\n );\n }\n\n /**\n * Single source of truth for the dated-capsules date-dir name (`YYYY-M-D`, no zero-pad).\n * Used by `getCapsulesRootDir` when writing and `pruneDatedCapsulesChildren` when reading,\n * so the two can never drift.\n */\n getDatedCapsuleDirName(date: Date = new Date()): string {\n return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`;\n }\n\n /**\n * Standard filter for \"real\" capsule subdirs we may walk or prune. Skips files, the trash\n * dir (dot-prefixed), `node_modules`, and any other hidden/internal dir.\n */\n private isPrunableSubdir(entry: fs.Dirent): boolean {\n return entry.isDirectory() && entry.name !== 'node_modules' && !entry.name.startsWith('.');\n }\n\n /**\n * Combined marker read + last-used resolution for a capsule dir: one `readJson`, one\n * fallback `stat`. Replaces the three-syscall (`readMarker` + `getOriginMarkerMtime` +\n * dir `stat`) idiom that was copy-pasted across the prune walks.\n */\n private async readMarkerInfo(dir: string): Promise<{ marker?: CapsuleOriginMarker; lastUsedMs: number }> {\n const marker = await this.readOriginMarker(dir);\n if (marker) {\n const mtime = await this.getOriginMarkerMtime(dir);\n if (mtime) return { marker, lastUsedMs: mtime.getTime() };\n }\n const stat = await fs.stat(dir).catch(() => undefined);\n return { marker, lastUsedMs: (stat?.mtime ?? new Date(0)).getTime() };\n }\n\n private async readOriginMarker(dir: string): Promise<CapsuleOriginMarker | undefined> {\n try {\n const raw = await fs.readJson(path.join(dir, CAPSULE_ORIGIN_FILE));\n if (\n raw &&\n typeof raw.originPath === 'string' &&\n // Reject unknown kinds (corrupted markers or values from a future Bit) so they\n // fall through to the 'unmarked' path in pruneCapsules rather than silently\n // skipping deletion.\n VALID_CAPSULE_KINDS.has(raw.kind)\n ) {\n return raw as CapsuleOriginMarker;\n }\n } catch {\n // missing or malformed — treat as unmarked\n }\n return undefined;\n }\n\n private async getOriginMarkerMtime(dir: string): Promise<Date | undefined> {\n try {\n const stat = await fs.stat(path.join(dir, CAPSULE_ORIGIN_FILE));\n return stat.mtime;\n } catch {\n return undefined;\n }\n }\n\n /**\n * Walk the global capsules root and return entries with their classification, size, and\n * last-used time. Used by prune and by `bit capsule list`.\n */\n async listAllCapsuleRoots(opts: { withSizes?: boolean } = {}): Promise<CapsuleRootEntry[]> {\n const withSizes = opts.withSizes !== false;\n const root = this.getRootDir();\n if (!(await fs.pathExists(root))) return [];\n const entries = await fs.readdir(root, { withFileTypes: true });\n const subdirs = entries.filter((e) => this.isPrunableSubdir(e));\n // Bounded concurrency: on a multi-GB cache with hundreds of subdirs and tens of\n // thousands of files per subdir, an unbounded Promise.all of recursive size walks\n // can hit OS file-descriptor limits (EMFILE) and thrash disk.\n return pMap(\n subdirs,\n async (entry) => {\n const subPath = path.join(root, entry.name);\n const { marker, lastUsedMs } = await this.readMarkerInfo(subPath);\n const sizeBytes = withSizes ? await this.computeDirSize(subPath) : 0;\n return {\n path: subPath,\n kind: (marker?.kind ?? 'unmarked') as CapsuleKind | 'unmarked',\n originPath: marker?.originPath,\n lastUsedMs,\n sizeBytes,\n };\n },\n { concurrency: concurrentIOLimit() }\n );\n }\n\n /**\n * Sum sizes of all entries under `dir`. Tolerant of symlinks and permission errors —\n * any failure returns the partial sum so we never throw from the prune path.\n * Uses bounded concurrency to avoid EMFILE on deep trees.\n */\n private async computeDirSize(dir: string): Promise<number> {\n let total = 0;\n const concurrency = concurrentIOLimit();\n const walk = async (current: string) => {\n let entries: fs.Dirent[];\n try {\n entries = await fs.readdir(current, { withFileTypes: true });\n } catch {\n return;\n }\n await pMap(\n entries,\n async (entry) => {\n const p = path.join(current, entry.name);\n if (entry.isDirectory()) {\n await walk(p);\n } else if (entry.isFile()) {\n try {\n const st = await fs.lstat(p);\n total += st.size;\n } catch {\n // ignore\n }\n }\n },\n { concurrency }\n );\n };\n await walk(dir);\n return total;\n }\n\n /**\n * Apply the prune rules from the plan:\n * - workspace caps: deleted unconditionally (unless keepWorkspaceCaps)\n * - scope-aspects-root: never deleted as a whole; per-aspect-version children pruned by age\n * - scope caps and unmarked dirs older than threshold: deleted\n * - orphans (marker says originPath gone): deleted\n * - after the above, if sizeTargetGb given and size still exceeds it, evict oldest-first\n */\n async pruneCapsules(opts: PruneCapsulesOptions = {}): Promise<PruneCapsulesReport> {\n // Clamp to >= 0: a negative age would put the cutoff in the future (everything looks\n // \"too old\" → whole cache deleted); a negative size target would force evicting\n // everything. Both are almost certainly user error, so floor them at 0.\n const olderThanDays = Math.max(0, opts.olderThanDays ?? 30);\n const sizeTargetGb = opts.sizeTargetGb === undefined ? undefined : Math.max(0, opts.sizeTargetGb);\n const includeOrphans = opts.includeOrphans !== false;\n const keepWorkspaceCaps = opts.keepWorkspaceCaps === true;\n const dryRun = opts.dryRun === true;\n // Size accounting requires an expensive recursive lstat across the whole cache. Skip\n // it by default so the foreground command returns in ms (deletes are O(1) renames);\n // force on for size-target enforcement and when the caller asks for byte accounting.\n const computeSizes = opts.withSizes === true || sizeTargetGb !== undefined;\n const ageCutoffMs = Date.now() - olderThanDays * ONE_DAY_MS;\n const datedDirName = this.configStore.getConfig(CFG_CAPSULES_SCOPES_ASPECTS_DATED_DIR) || 'dated-capsules';\n\n const roots = await this.listAllCapsuleRoots({ withSizes: computeSizes });\n const totalSizeBefore = computeSizes ? roots.reduce((sum, r) => sum + r.sizeBytes, 0) : 0;\n const removed: PruneCapsulesReport['removed'] = [];\n\n const removeEntry = (\n p: string,\n kind: CapsuleKind | 'unmarked',\n reason: string,\n sizeBytes: number,\n originPath?: string\n ) => this.recordRemoval(removed, { path: p, kind, reason, sizeBytes, originPath }, dryRun);\n\n for (const root of roots) {\n if (path.basename(root.path) === datedDirName) {\n await this.pruneDatedCapsulesChildren(root.path, dryRun, computeSizes, removed);\n continue;\n }\n if (root.kind === 'workspace') {\n if (keepWorkspaceCaps) continue;\n await removeEntry(root.path, root.kind, 'workspace-cap', root.sizeBytes, root.originPath);\n continue;\n }\n if (root.kind === 'scope' || root.kind === 'unmarked') {\n const orphan = includeOrphans && root.originPath && !(await fs.pathExists(root.originPath));\n const tooOld = root.lastUsedMs < ageCutoffMs;\n if (orphan) {\n await removeEntry(root.path, root.kind, 'orphan', root.sizeBytes, root.originPath);\n } else if (tooOld) {\n // For unmarked dirs, sniff content first to avoid nuking a legacy scope-aspects root.\n if (root.kind === 'unmarked' && (await this.looksLikeAspectsRoot(root.path))) {\n await this.pruneAspectsRootChildren(root.path, ageCutoffMs, dryRun, computeSizes, removed);\n } else {\n await removeEntry(root.path, root.kind, `older-than-${olderThanDays}d`, root.sizeBytes, root.originPath);\n }\n }\n continue;\n }\n if (root.kind === 'scope-aspects-root') {\n await this.pruneAspectsRootChildren(root.path, ageCutoffMs, dryRun, computeSizes, removed);\n continue;\n }\n }\n\n if (sizeTargetGb !== undefined) {\n await this.applySizeTarget(sizeTargetGb, removed, dryRun);\n }\n\n const totalRemovedBytes = removed.reduce((sum, r) => sum + r.sizeBytes, 0);\n // For dry-run, report the *projected* post-prune size so the CLI summary stays\n // internally consistent (cache: X → X − freed). Real prune subtracts the same.\n const totalSizeAfter = Math.max(0, totalSizeBefore - totalRemovedBytes);\n\n return {\n removed,\n totalRemovedBytes,\n totalSizeBeforeBytes: totalSizeBefore,\n totalSizeAfterBytes: totalSizeAfter,\n dryRun,\n };\n }\n\n /**\n * Record a removal in the prune report and, unless this is a dry run, actually delete it\n * (fast rename-to-trash). Keeps the \"report and delete are gated by the same dryRun flag\"\n * invariant in one place so the per-kind prune helpers can't drift apart.\n */\n private async recordRemoval(\n removed: PruneCapsulesReport['removed'],\n entry: PruneCapsulesReport['removed'][number],\n dryRun: boolean\n ): Promise<void> {\n removed.push(entry);\n this.logger.debug(\n `[capsule-prune] ${dryRun ? 'would remove' : 'removing'} [${entry.kind} · ${entry.reason}] ${entry.path}` +\n (entry.originPath ? ` origin=${entry.originPath}` : '')\n );\n if (!dryRun) await this.scheduleFastDelete(entry.path);\n }\n\n /**\n * The `dated-capsules` dir holds per-date subdirs (`YYYY-M-D`) of in-flight isolation\n * runs. These are recreated on every isolation, so anything that isn't *today*'s\n * subdir is leftover from a previous run and safe to delete. Today's subdir is\n * preserved to avoid racing a concurrent bit process that may still be writing to it.\n */\n private async pruneDatedCapsulesChildren(\n rootPath: string,\n dryRun: boolean,\n computeSizes: boolean,\n removed: PruneCapsulesReport['removed']\n ): Promise<void> {\n const todayDir = this.getDatedCapsuleDirName();\n let entries: fs.Dirent[];\n try {\n entries = await fs.readdir(rootPath, { withFileTypes: true });\n } catch {\n return;\n }\n for (const entry of entries) {\n if (!this.isPrunableSubdir(entry)) continue;\n if (entry.name === todayDir) continue;\n const childPath = path.join(rootPath, entry.name);\n const sizeBytes = computeSizes ? await this.computeDirSize(childPath) : 0;\n await this.recordRemoval(\n removed,\n { path: childPath, kind: 'unmarked', reason: 'dated-capsules-not-today', sizeBytes },\n dryRun\n );\n }\n }\n\n /**\n * Legacy unmarked dirs may still be a scope-aspects root. Heuristic: a child subdir whose\n * name contains `@` (aspect-version pattern like `teambit.node_node@1.3.4`).\n */\n private async looksLikeAspectsRoot(dir: string): Promise<boolean> {\n try {\n const entries = await fs.readdir(dir, { withFileTypes: true });\n return entries.some((e) => e.isDirectory() && e.name.includes('@'));\n } catch {\n return false;\n }\n }\n\n /**\n * Prune per-aspect-version children of a scope-aspects root purely by age (marker mtime,\n * which is touched on every aspect load).\n *\n * Note there's deliberately no orphan check here: a scope-aspect child's `originPath` is\n * the *logical* scope-aspects path (e.g. `<scope.path>-aspects`) used only to hash the\n * capsule root dir name — it need not exist as a real directory, so treating a missing\n * `originPath` as \"orphan\" would wrongly delete capsules of currently-used aspects.\n * Orphan pruning is still honored elsewhere for `workspace`/`scope` kinds.\n */\n private async pruneAspectsRootChildren(\n rootPath: string,\n ageCutoffMs: number,\n dryRun: boolean,\n computeSizes: boolean,\n removed: PruneCapsulesReport['removed']\n ): Promise<void> {\n let entries: fs.Dirent[];\n try {\n entries = await fs.readdir(rootPath, { withFileTypes: true });\n } catch {\n return;\n }\n for (const entry of entries) {\n if (!this.isPrunableSubdir(entry)) continue;\n const childPath = path.join(rootPath, entry.name);\n const { marker, lastUsedMs } = await this.readMarkerInfo(childPath);\n if (lastUsedMs < ageCutoffMs) {\n const sizeBytes = computeSizes ? await this.computeDirSize(childPath) : 0;\n await this.recordRemoval(\n removed,\n {\n path: childPath,\n kind: 'scope-aspect',\n reason: 'aspect-older-than-cutoff',\n sizeBytes,\n originPath: marker?.originPath,\n },\n dryRun\n );\n }\n }\n }\n\n /**\n * After the standard prune, if total still exceeds the target, keep evicting the\n * oldest remaining aspect-version subdirs until under the limit.\n */\n private async applySizeTarget(\n sizeTargetGb: number,\n removed: PruneCapsulesReport['removed'],\n dryRun: boolean\n ): Promise<void> {\n const targetBytes = sizeTargetGb * 1024 * 1024 * 1024;\n const removedPaths = new Set(removed.map((r) => r.path));\n // Re-walk what's left (one pass, with sizes) to find both the current total and the\n // oldest aspect-version children to evict.\n const roots = await this.listAllCapsuleRoots();\n const totalBytes = roots.reduce((sum, r) => sum + r.sizeBytes, 0);\n const aspectChildren: Array<{ path: string; lastUsedMs: number; sizeBytes: number; originPath?: string }> = [];\n for (const root of roots) {\n if (\n root.kind !== 'scope-aspects-root' &&\n !(root.kind === 'unmarked' && (await this.looksLikeAspectsRoot(root.path)))\n ) {\n continue;\n }\n let entries: fs.Dirent[] = [];\n try {\n entries = await fs.readdir(root.path, { withFileTypes: true });\n } catch {\n continue;\n }\n for (const entry of entries) {\n if (!this.isPrunableSubdir(entry)) continue;\n const childPath = path.join(root.path, entry.name);\n if (removedPaths.has(childPath)) continue;\n const { marker, lastUsedMs } = await this.readMarkerInfo(childPath);\n const sizeBytes = await this.computeDirSize(childPath);\n aspectChildren.push({ path: childPath, lastUsedMs, sizeBytes, originPath: marker?.originPath });\n }\n }\n aspectChildren.sort((a, b) => a.lastUsedMs - b.lastUsedMs);\n // In dry-run the standard-prune entries are still on disk (counted in totalBytes), so\n // subtract them; in a real run they were already moved to trash and excluded from the walk.\n let remainingBytes = totalBytes - (dryRun ? removed.reduce((s, r) => s + r.sizeBytes, 0) : 0);\n for (const child of aspectChildren) {\n if (remainingBytes <= targetBytes) break;\n await this.recordRemoval(\n removed,\n {\n path: child.path,\n kind: 'scope-aspect',\n reason: `size-target-${sizeTargetGb}gb`,\n sizeBytes: child.sizeBytes,\n originPath: child.originPath,\n },\n dryRun\n );\n remainingBytes -= child.sizeBytes;\n }\n }\n}\n"],"mappings":";;;;;;AAUA,SAAAA,SAAA;EAAA,MAAAC,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAH,QAAA,YAAAA,CAAA;IAAA,OAAAC,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAG,MAAA;EAAA,MAAAH,IAAA,GAAAE,OAAA;EAAAC,KAAA,YAAAA,CAAA;IAAA,OAAAH,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAI,MAAA;EAAA,MAAAJ,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAE,KAAA,YAAAA,CAAA;IAAA,OAAAJ,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAK,eAAA;EAAA,MAAAL,IAAA,GAAAE,OAAA;EAAAG,cAAA,YAAAA,CAAA;IAAA,OAAAL,IAAA;EAAA;EAAA,OAAAA,IAAA;AAAA;AACA,SAAAM,MAAA;EAAA,MAAAN,IAAA,GAAAC,sBAAA,CAAAC,OAAA;EAAAI,KAAA,YAAAA,CAAA;IAAA,OAAAN,IAAA;EAAA;EA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QAAW,CAAC,GAAG,MAAM,IAAI,CAACF,cAAc,CAAC2D,SAAS,CAAC;QACnE,MAAM1C,SAAS,GAAG,MAAM,IAAI,CAACC,cAAc,CAACyC,SAAS,CAAC;QACtDM,cAAc,CAACT,IAAI,CAAC;UAAErJ,IAAI,EAAEwJ,SAAS;UAAEzD,UAAU;UAAEe,SAAS;UAAErH,UAAU,EAAEH,MAAM,EAAEG;QAAW,CAAC,CAAC;MACjG;IACF;IACAqK,cAAc,CAACC,IAAI,CAAC,CAACC,CAAC,EAAEC,CAAC,KAAKD,CAAC,CAACjE,UAAU,GAAGkE,CAAC,CAAClE,UAAU,CAAC;IAC1D;IACA;IACA,IAAImE,cAAc,GAAGL,UAAU,IAAIhC,MAAM,GAAGU,OAAO,CAACH,MAAM,CAAC,CAAC+B,CAAC,EAAE7B,CAAC,KAAK6B,CAAC,GAAG7B,CAAC,CAACxB,SAAS,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC;IAC7F,KAAK,MAAMpD,KAAK,IAAIoG,cAAc,EAAE;MAClC,IAAII,cAAc,IAAIP,WAAW,EAAE;MACnC,MAAM,IAAI,CAACjB,aAAa,CACtBH,OAAO,EACP;QACEvI,IAAI,EAAE0D,KAAK,CAAC1D,IAAI;QAChBsE,IAAI,EAAE,cAAc;QACpBmE,MAAM,EAAE,eAAepF,YAAY,IAAI;QACvCyD,SAAS,EAAEpD,KAAK,CAACoD,SAAS;QAC1BrH,UAAU,EAAEiE,KAAK,CAACjE;MACpB,CAAC,EACDoI,MACF,CAAC;MACDqC,cAAc,IAAIxG,KAAK,CAACoD,SAAS;IACnC;EACF;AACF;AAAC5I,OAAA,CAAAW,YAAA,GAAAA,YAAA","ignoreList":[]}
1
+ {"version":3,"names":["_fsExtra","data","_interopRequireDefault","require","_uuid","_path","_child_process","_pMap","_harmonyModules","_harmonyModules2","_legacy","e","__esModule","default","CAPSULE_ORIGIN_FILE","exports","CAPSULE_TRASH_DIR","ONE_DAY_MS","VALID_CAPSULE_KINDS","Set","toFiniteNumber","value","undefined","n","Number","isFinite","CapsuleCache","constructor","logger","cli","configStore","getRootDir","deleteCapsules","rootDir","dirToDelete","marker","readOriginMarker","debug","originPath","scheduleFastDelete","dir","exists","fs","pathExists","globalRoot","path","resolve","remove","trashRoot","join","ensureDir","trashTarget","basename","v4","move","overwrite","err","message","sweepTrashAsync","existsSync","lockPath","isSweepLockActive","writeFileSync","String","process","pid","flag","spawnDetachedSweep","pidStr","readFileSync","trim","kill","registerAutoPruneHook","registerOnBeforeExit","maybeAutoPrune","isFeatureEnabled","CAPSULE_AUTO_PRUNE","enabled","getConfig","CFG_CAPSULES_AUTO_PRUNE","root","stampPath","isStampFresh","stat","Date","now","mtime","getTime","claimPath","claimed","close","open","claimStat","outputFile","olderThanDays","Math","max","CFG_CAPSULES_MAX_AGE_DAYS","spawnDetachedAutoPrune","bitEntry","argv","child","spawn","execPath","detached","stdio","windowsHide","unref","script","JSON","stringify","removeSync","ensureOriginMarker","kind","markerPath","utimes","createdAt","toISOString","outputJson","ensureAspectCapsuleMarkers","capsuleList","rootOriginPath","Promise","all","map","capsule","getDatedCapsuleDirName","date","getFullYear","getMonth","getDate","isPrunableSubdir","entry","isDirectory","name","startsWith","readMarkerInfo","getOriginMarkerMtime","lastUsedMs","catch","raw","readJson","has","listAllCapsuleRoots","opts","withSizes","entries","readdir","withFileTypes","subdirs","filter","pMap","subPath","sizeBytes","computeDirSize","concurrency","concurrentIOLimit","total","walk","current","p","isFile","st","lstat","size","pruneCapsules","includeOrphans","keepWorkspaceCaps","dryRun","computeSizes","ageCutoffMs","datedDirName","CFG_CAPSULES_SCOPES_ASPECTS_DATED_DIR","roots","totalSizeBefore","reduce","sum","r","removed","removeEntry","reason","recordRemoval","pruneDatedCapsulesChildren","orphan","tooOld","looksLikeAspectsRoot","pruneAspectsRootChildren","totalRemovedBytes","totalSizeAfter","totalSizeBeforeBytes","totalSizeAfterBytes","push","rootPath","todayDir","childPath","some","includes"],"sources":["capsule-cache.ts"],"sourcesContent":["/**\n * Manages the global capsules cache: origin markers, fast-delete + trash sweep, and the\n * prune pipeline (manual `bit capsule prune` and the gated auto-prune trigger).\n *\n * Owned by `IsolatorMain` but operationally independent — the isolator constructs an\n * instance, registers its hooks, and delegates the externally-visible cache-management\n * methods (`deleteCapsules`, `pruneCapsules`, `listAllCapsuleRoots`) to it. Keeps\n * `isolator.main.runtime.ts` focused on creating isolated component environments rather\n * than also being responsible for evicting them.\n */\nimport fs from 'fs-extra';\nimport { v4 } from 'uuid';\nimport path from 'path';\nimport { spawn } from 'child_process';\nimport pMap from 'p-map';\nimport type { Logger } from '@teambit/logger';\nimport type { CLIMain } from '@teambit/cli';\nimport type { ConfigStoreMain } from '@teambit/config-store';\nimport { concurrentIOLimit } from '@teambit/harmony.modules.concurrency';\nimport { isFeatureEnabled, CAPSULE_AUTO_PRUNE } from '@teambit/harmony.modules.feature-toggle';\nimport {\n CFG_CAPSULES_AUTO_PRUNE,\n CFG_CAPSULES_MAX_AGE_DAYS,\n CFG_CAPSULES_SCOPES_ASPECTS_DATED_DIR,\n} from '@teambit/legacy.constants';\nimport type CapsuleList from './capsule-list';\n\n/**\n * Marker file written into every capsule dir we manage. Its presence tells the prune logic\n * what kind of dir this is, where it came from, and (via its mtime) when it was last used.\n */\nexport const CAPSULE_ORIGIN_FILE = '.bit-capsule-origin.json';\nexport const CAPSULE_TRASH_DIR = '.trash';\n\nconst ONE_DAY_MS = 24 * 60 * 60 * 1000;\n\nexport type CapsuleKind = 'workspace' | 'scope-aspects-root' | 'scope-aspect' | 'scope';\n\nconst VALID_CAPSULE_KINDS: ReadonlySet<string> = new Set(['workspace', 'scope-aspects-root', 'scope-aspect', 'scope']);\n\nexport type CapsuleOriginMarker = {\n originPath: string;\n createdAt: string;\n kind: CapsuleKind;\n};\n\nexport type PruneCapsulesOptions = {\n olderThanDays?: number;\n includeOrphans?: boolean;\n keepWorkspaceCaps?: boolean;\n dryRun?: boolean;\n /**\n * Compute byte sizes for every entry being considered. When false, all `sizeBytes`\n * in the report are 0 and the cache walk skips the expensive recursive `lstat` pass —\n * deletion (rename-to-trash) is O(1) and runs in milliseconds even on multi-GB caches.\n * Opt-in (via `bit capsule prune --with-sizes`) since the walk is slow on large caches.\n */\n withSizes?: boolean;\n};\n\nexport type PruneCapsulesReport = {\n /** `originPath` is the workspace/scope a capsule was created for (from its marker), when known. */\n removed: { path: string; kind: CapsuleKind | 'unmarked'; reason: string; sizeBytes: number; originPath?: string }[];\n totalRemovedBytes: number;\n totalSizeBeforeBytes: number;\n totalSizeAfterBytes: number;\n dryRun: boolean;\n};\n\nexport type CapsuleRootEntry = {\n path: string;\n kind: CapsuleKind | 'unmarked';\n originPath?: string;\n lastUsedMs: number;\n sizeBytes: number;\n};\n\nfunction toFiniteNumber(value: unknown): number | undefined {\n if (value === undefined || value === null || value === '') return undefined;\n const n = Number(value);\n return Number.isFinite(n) ? n : undefined;\n}\n\nexport class CapsuleCache {\n constructor(\n private logger: Logger,\n private cli: CLIMain,\n private configStore: ConfigStoreMain,\n /** Thunk so the cache stays independent of `GlobalConfigMain` — IsolatorMain forwards it. */\n private getRootDir: () => string\n ) {}\n\n async deleteCapsules(rootDir?: string): Promise<string> {\n const dirToDelete = rootDir || this.getRootDir();\n const marker = await this.readOriginMarker(dirToDelete);\n this.logger.debug(\n `[capsule-delete] removing ${dirToDelete}` + (marker?.originPath ? ` origin=${marker.originPath}` : '')\n );\n await this.scheduleFastDelete(dirToDelete);\n return dirToDelete;\n }\n\n /**\n * Move a capsule dir into a sibling `.trash/<uuid>/` so it disappears from the cache\n * immediately (same-filesystem rename is O(1)), then kick off a detached `rm -rf` so the\n * actual byte-by-byte cleanup happens in the background. This avoids the multi-second\n * stalls users see when deleting capsules with thousands of files.\n */\n async scheduleFastDelete(dir: string): Promise<void> {\n const exists = await fs.pathExists(dir);\n if (!exists) return;\n const globalRoot = this.getRootDir();\n // Edge case: deleting the global root itself. We can't move a dir into its own\n // child (`.trash/...`), so just do a direct remove. This is rare — only `bit\n // capsule delete --all` hits it.\n if (path.resolve(dir) === path.resolve(globalRoot)) {\n await fs.remove(dir);\n return;\n }\n const trashRoot = path.join(globalRoot, CAPSULE_TRASH_DIR);\n await fs.ensureDir(trashRoot);\n const trashTarget = path.join(trashRoot, `${path.basename(dir)}-${v4()}`);\n try {\n await fs.move(dir, trashTarget, { overwrite: true });\n } catch (err: any) {\n // Likely cross-device — fall back to a synchronous remove.\n this.logger.debug(`scheduleFastDelete: rename failed for ${dir}, falling back to fs.remove (${err.message})`);\n await fs.remove(dir);\n return;\n }\n // Run through the gated sweepTrashAsync path so we never have more than one sweep\n // running concurrently — even if many bit processes are moving things to trash.\n this.sweepTrashAsync();\n }\n\n /**\n * Sweep the `.trash` dir in a detached background process. Gated by a PID-stamped\n * lock so we never have more than one sweep running at a time across all concurrent\n * bit processes — previously we spawned one per `bit` invocation and they piled up\n * into the thousands, saturating disk I/O.\n */\n sweepTrashAsync(): void {\n const trashRoot = path.join(this.getRootDir(), CAPSULE_TRASH_DIR);\n // No trash → nothing to do. Cheap synchronous check avoids spawning a process at all.\n if (!fs.existsSync(trashRoot)) return;\n const lockPath = path.join(this.getRootDir(), '.trash-sweep.lock');\n if (this.isSweepLockActive(lockPath)) {\n this.logger.debug(`trash sweep already running (per ${lockPath}), skipping`);\n return;\n }\n try {\n fs.writeFileSync(lockPath, String(process.pid), { flag: 'w' });\n } catch (err: any) {\n this.logger.debug(`failed to write sweep lock at ${lockPath}: ${err.message}`);\n return;\n }\n this.spawnDetachedSweep(trashRoot, lockPath);\n }\n\n /**\n * A sweep lock is \"active\" if the PID it names is still running. If the PID file\n * exists but the process is gone (e.g. crashed mid-sweep), we treat it as stale and\n * allow a new sweep to claim it.\n */\n private isSweepLockActive(lockPath: string): boolean {\n let pidStr: string;\n try {\n pidStr = fs.readFileSync(lockPath, 'utf8').trim();\n } catch {\n return false;\n }\n const pid = Number(pidStr);\n if (!Number.isFinite(pid) || pid <= 0) return false;\n try {\n // Signal 0 = \"is this PID alive?\" — no actual signal sent.\n process.kill(pid, 0);\n return true;\n } catch {\n return false;\n }\n }\n\n /**\n * Register a process-exit hook that, at most once per ~24h, spawns a detached\n * `bit capsule prune` child so the actual work runs out-of-process and never delays\n * the parent's exit. Gated by the mtime of a stamp file under the capsules root so\n * concurrent Bit invocations can't all trigger it at once, and behind the\n * `capsule-auto-prune` feature flag while the behavior is being validated.\n */\n registerAutoPruneHook(): void {\n this.cli.registerOnBeforeExit(async () => {\n try {\n await this.maybeAutoPrune();\n } catch (err: any) {\n this.logger.debug(`auto-prune skipped due to error: ${err?.message ?? err}`);\n }\n });\n }\n\n private async maybeAutoPrune(): Promise<void> {\n // Experimental: the automatic prune only runs for users who opt in via the feature flag\n // (`BIT_FEATURES=capsule-auto-prune` or `bit config set features=capsule-auto-prune`).\n // Until it's promoted to GA, the default behavior is unchanged — capsules are never\n // auto-deleted. The manual `bit capsule prune` command is always available regardless.\n if (!isFeatureEnabled(CAPSULE_AUTO_PRUNE)) return;\n\n // configStore may surface this as either string `'false'` (from `bit config set`)\n // or boolean `false` (from a hand-edited JSON config) — accept both. This is a\n // secondary escape hatch for once the feature is GA and the flag is removed.\n const enabled = this.configStore.getConfig(CFG_CAPSULES_AUTO_PRUNE);\n if (enabled === 'false' || (enabled as unknown) === false) return;\n\n const root = this.getRootDir();\n if (!(await fs.pathExists(root))) return;\n\n const stampPath = path.join(root, '.last-capsule-prune');\n const isStampFresh = async (): Promise<boolean> => {\n try {\n const stat = await fs.stat(stampPath);\n return Date.now() - stat.mtime.getTime() < ONE_DAY_MS;\n } catch {\n return false; // missing — needs a prune\n }\n };\n // Fast path: stamp is recent, nothing to do (no contention here).\n if (await isStampFresh()) return;\n\n // Atomic claim: only one process across all concurrent bit invocations may win the\n // daily slot. `wx` is O_CREAT|O_EXCL — it throws if the lock already exists, so the\n // check-and-write below can't race. The lock is held only for the few ms it takes to\n // re-check the stamp and spawn the detached child, then removed in `finally`.\n const claimPath = `${stampPath}.claim`;\n let claimed = false;\n try {\n await fs.close(await fs.open(claimPath, 'wx'));\n claimed = true;\n } catch {\n // Another process is mid-claim, or a previous run leaked the lock. If it's stale\n // (older than the daily window), reclaim it by removing + re-opening with O_EXCL —\n // if two processes race the reclaim, only one's `wx` open succeeds and the other\n // yields. Otherwise yield.\n try {\n const claimStat = await fs.stat(claimPath);\n if (Date.now() - claimStat.mtime.getTime() < ONE_DAY_MS) return;\n await fs.remove(claimPath);\n await fs.close(await fs.open(claimPath, 'wx'));\n claimed = true;\n } catch {\n return;\n }\n }\n try {\n // Re-check under the lock: a process that just held it may have refreshed the stamp.\n if (await isStampFresh()) return;\n await fs.outputFile(stampPath, '');\n\n // Guard against non-numeric/empty config (NaN) and negative values (which would\n // invert the age cutoff and wipe the whole cache).\n const olderThanDays = Math.max(0, toFiniteNumber(this.configStore.getConfig(CFG_CAPSULES_MAX_AGE_DAYS)) ?? 30);\n\n this.logger.debug(`[auto-prune] spawning detached child. olderThanDays=${olderThanDays}`);\n this.spawnDetachedAutoPrune(olderThanDays);\n } finally {\n if (claimed) {\n try {\n await fs.remove(claimPath);\n } catch {\n // ignore — a stale claim lock is reclaimed by the age check above\n }\n }\n }\n }\n\n /**\n * Fire-and-forget: spawn a detached child running `bit capsule prune`. Using the same\n * bit binary that's currently running (via process.argv[0] + argv[1]) so we don't depend\n * on PATH. stdio is ignored so nothing leaks to the user's terminal.\n *\n * Recursion guard: the child also runs onBeforeExit → maybeAutoPrune, but it reads the\n * stamp file that we just wrote and bails out before re-spawning.\n */\n private spawnDetachedAutoPrune(olderThanDays: number): void {\n const bitEntry = process.argv[1];\n if (!bitEntry) {\n this.logger.debug('[auto-prune] cannot detach: process.argv[1] is empty');\n return;\n }\n try {\n const child = spawn(process.execPath, [bitEntry, 'capsule', 'prune', '--older-than', String(olderThanDays)], {\n detached: true,\n stdio: 'ignore',\n windowsHide: true,\n });\n child.unref();\n } catch (err: any) {\n this.logger.debug(`[auto-prune] failed to spawn detached child: ${err.message}`);\n }\n }\n\n /**\n * Spawn one detached Node process that recursively removes `trashRoot`. Using\n * `process.execPath` with an inline `fs.rmSync` keeps this portable across macOS,\n * Linux, and Windows (where there's no `rm` binary). When `lockPath` is given, the\n * child clears the lock on exit so the next bit invocation can claim a fresh sweep slot.\n */\n private spawnDetachedSweep(trashRoot: string, lockPath?: string): void {\n const script = lockPath\n ? `try { require('fs').rmSync(${JSON.stringify(trashRoot)}, { recursive: true, force: true }); } finally { try { require('fs').rmSync(${JSON.stringify(lockPath)}, { force: true }); } catch (_) {} }`\n : `require('fs').rmSync(${JSON.stringify(trashRoot)}, { recursive: true, force: true })`;\n try {\n const child = spawn(process.execPath, ['-e', script], {\n detached: true,\n stdio: 'ignore',\n windowsHide: true,\n });\n child.unref();\n } catch (err: any) {\n this.logger.debug(`failed to spawn detached trash sweep: ${err.message}`);\n // Don't leak the lock if the spawn itself failed. Use fs-extra's removeSync\n // (rmSync isn't in the @types/fs-extra version pinned by this component).\n if (lockPath) {\n try {\n fs.removeSync(lockPath);\n } catch {\n // ignore\n }\n }\n }\n }\n\n /**\n * Write the origin marker if missing; otherwise just bump its mtime so it reflects\n * \"last used at\". Failures are non-fatal — markers are best-effort metadata.\n */\n async ensureOriginMarker(dir: string, kind: CapsuleKind, originPath: string): Promise<void> {\n const markerPath = path.join(dir, CAPSULE_ORIGIN_FILE);\n try {\n if (await fs.pathExists(markerPath)) {\n const now = new Date();\n await fs.utimes(markerPath, now, now);\n return;\n }\n const marker: CapsuleOriginMarker = {\n originPath,\n createdAt: new Date().toISOString(),\n kind,\n };\n await fs.outputJson(markerPath, marker);\n } catch (err: any) {\n this.logger.debug(`failed to write capsule origin marker at ${markerPath}: ${err.message}`);\n }\n }\n\n /**\n * Mark all per-component capsule subdirs as scope-aspect kind, originated from the\n * scope-aspects root. Used right after a scope-aspects isolation.\n */\n async ensureAspectCapsuleMarkers(capsuleList: CapsuleList, rootOriginPath: string): Promise<void> {\n await Promise.all(\n capsuleList.map(async (capsule) => {\n if (!fs.existsSync(capsule.path)) return;\n await this.ensureOriginMarker(capsule.path, 'scope-aspect', rootOriginPath);\n })\n );\n }\n\n /**\n * Single source of truth for the dated-capsules date-dir name (`YYYY-M-D`, no zero-pad).\n * Used by `getCapsulesRootDir` when writing and `pruneDatedCapsulesChildren` when reading,\n * so the two can never drift.\n */\n getDatedCapsuleDirName(date: Date = new Date()): string {\n return `${date.getFullYear()}-${date.getMonth() + 1}-${date.getDate()}`;\n }\n\n /**\n * Standard filter for \"real\" capsule subdirs we may walk or prune. Skips files, the trash\n * dir (dot-prefixed), `node_modules`, and any other hidden/internal dir.\n */\n private isPrunableSubdir(entry: fs.Dirent): boolean {\n return entry.isDirectory() && entry.name !== 'node_modules' && !entry.name.startsWith('.');\n }\n\n /**\n * Combined marker read + last-used resolution for a capsule dir: one `readJson`, one\n * fallback `stat`. Replaces the three-syscall (`readMarker` + `getOriginMarkerMtime` +\n * dir `stat`) idiom that was copy-pasted across the prune walks.\n */\n private async readMarkerInfo(dir: string): Promise<{ marker?: CapsuleOriginMarker; lastUsedMs: number }> {\n const marker = await this.readOriginMarker(dir);\n if (marker) {\n const mtime = await this.getOriginMarkerMtime(dir);\n if (mtime) return { marker, lastUsedMs: mtime.getTime() };\n }\n const stat = await fs.stat(dir).catch(() => undefined);\n return { marker, lastUsedMs: (stat?.mtime ?? new Date(0)).getTime() };\n }\n\n private async readOriginMarker(dir: string): Promise<CapsuleOriginMarker | undefined> {\n try {\n const raw = await fs.readJson(path.join(dir, CAPSULE_ORIGIN_FILE));\n if (\n raw &&\n typeof raw.originPath === 'string' &&\n // Reject unknown kinds (corrupted markers or values from a future Bit) so they\n // fall through to the 'unmarked' path in pruneCapsules rather than silently\n // skipping deletion.\n VALID_CAPSULE_KINDS.has(raw.kind)\n ) {\n return raw as CapsuleOriginMarker;\n }\n } catch {\n // missing or malformed — treat as unmarked\n }\n return undefined;\n }\n\n private async getOriginMarkerMtime(dir: string): Promise<Date | undefined> {\n try {\n const stat = await fs.stat(path.join(dir, CAPSULE_ORIGIN_FILE));\n return stat.mtime;\n } catch {\n return undefined;\n }\n }\n\n /**\n * Walk the global capsules root and return entries with their classification, size, and\n * last-used time. Used by prune and by `bit capsule list`.\n */\n async listAllCapsuleRoots(opts: { withSizes?: boolean } = {}): Promise<CapsuleRootEntry[]> {\n const withSizes = opts.withSizes !== false;\n const root = this.getRootDir();\n if (!(await fs.pathExists(root))) return [];\n const entries = await fs.readdir(root, { withFileTypes: true });\n const subdirs = entries.filter((e) => this.isPrunableSubdir(e));\n // Bounded concurrency: on a multi-GB cache with hundreds of subdirs and tens of\n // thousands of files per subdir, an unbounded Promise.all of recursive size walks\n // can hit OS file-descriptor limits (EMFILE) and thrash disk.\n return pMap(\n subdirs,\n async (entry) => {\n const subPath = path.join(root, entry.name);\n const { marker, lastUsedMs } = await this.readMarkerInfo(subPath);\n const sizeBytes = withSizes ? await this.computeDirSize(subPath) : 0;\n return {\n path: subPath,\n kind: (marker?.kind ?? 'unmarked') as CapsuleKind | 'unmarked',\n originPath: marker?.originPath,\n lastUsedMs,\n sizeBytes,\n };\n },\n { concurrency: concurrentIOLimit() }\n );\n }\n\n /**\n * Sum sizes of all entries under `dir`. Tolerant of symlinks and permission errors —\n * any failure returns the partial sum so we never throw from the prune path.\n * Uses bounded concurrency to avoid EMFILE on deep trees.\n */\n private async computeDirSize(dir: string): Promise<number> {\n let total = 0;\n const concurrency = concurrentIOLimit();\n const walk = async (current: string) => {\n let entries: fs.Dirent[];\n try {\n entries = await fs.readdir(current, { withFileTypes: true });\n } catch {\n return;\n }\n await pMap(\n entries,\n async (entry) => {\n const p = path.join(current, entry.name);\n if (entry.isDirectory()) {\n await walk(p);\n } else if (entry.isFile()) {\n try {\n const st = await fs.lstat(p);\n total += st.size;\n } catch {\n // ignore\n }\n }\n },\n { concurrency }\n );\n };\n await walk(dir);\n return total;\n }\n\n /**\n * Apply the prune rules from the plan:\n * - workspace caps: deleted unconditionally (unless keepWorkspaceCaps)\n * - scope-aspects-root: never deleted as a whole; per-aspect-version children pruned by age\n * - scope caps and unmarked dirs older than threshold: deleted\n * - orphans (marker says originPath gone): deleted\n */\n async pruneCapsules(opts: PruneCapsulesOptions = {}): Promise<PruneCapsulesReport> {\n // Clamp to >= 0: a negative age would put the cutoff in the future (everything looks\n // \"too old\" → whole cache deleted), almost certainly user error, so floor it at 0.\n const olderThanDays = Math.max(0, opts.olderThanDays ?? 30);\n const includeOrphans = opts.includeOrphans !== false;\n const keepWorkspaceCaps = opts.keepWorkspaceCaps === true;\n const dryRun = opts.dryRun === true;\n // Size accounting requires an expensive recursive lstat across the whole cache. Skip\n // it by default so the command returns in ms (deletes are O(1) renames); opt in via\n // `--with-sizes` when you want byte totals in the report.\n const computeSizes = opts.withSizes === true;\n const ageCutoffMs = Date.now() - olderThanDays * ONE_DAY_MS;\n const datedDirName = this.configStore.getConfig(CFG_CAPSULES_SCOPES_ASPECTS_DATED_DIR) || 'dated-capsules';\n\n const roots = await this.listAllCapsuleRoots({ withSizes: computeSizes });\n const totalSizeBefore = computeSizes ? roots.reduce((sum, r) => sum + r.sizeBytes, 0) : 0;\n const removed: PruneCapsulesReport['removed'] = [];\n\n const removeEntry = (\n p: string,\n kind: CapsuleKind | 'unmarked',\n reason: string,\n sizeBytes: number,\n originPath?: string\n ) => this.recordRemoval(removed, { path: p, kind, reason, sizeBytes, originPath }, dryRun);\n\n for (const root of roots) {\n if (path.basename(root.path) === datedDirName) {\n await this.pruneDatedCapsulesChildren(root.path, dryRun, computeSizes, removed);\n continue;\n }\n if (root.kind === 'workspace') {\n if (keepWorkspaceCaps) continue;\n await removeEntry(root.path, root.kind, 'workspace-cap', root.sizeBytes, root.originPath);\n continue;\n }\n if (root.kind === 'scope' || root.kind === 'unmarked') {\n const orphan = includeOrphans && root.originPath && !(await fs.pathExists(root.originPath));\n const tooOld = root.lastUsedMs < ageCutoffMs;\n if (orphan) {\n await removeEntry(root.path, root.kind, 'orphan', root.sizeBytes, root.originPath);\n } else if (tooOld) {\n // For unmarked dirs, sniff content first to avoid nuking a legacy scope-aspects root.\n if (root.kind === 'unmarked' && (await this.looksLikeAspectsRoot(root.path))) {\n await this.pruneAspectsRootChildren(root.path, ageCutoffMs, dryRun, computeSizes, removed);\n } else {\n await removeEntry(root.path, root.kind, `older-than-${olderThanDays}d`, root.sizeBytes, root.originPath);\n }\n }\n continue;\n }\n if (root.kind === 'scope-aspects-root') {\n await this.pruneAspectsRootChildren(root.path, ageCutoffMs, dryRun, computeSizes, removed);\n continue;\n }\n }\n\n const totalRemovedBytes = removed.reduce((sum, r) => sum + r.sizeBytes, 0);\n // For dry-run, report the *projected* post-prune size so the CLI summary stays\n // internally consistent (cache: X → X − freed). Real prune subtracts the same.\n const totalSizeAfter = Math.max(0, totalSizeBefore - totalRemovedBytes);\n\n return {\n removed,\n totalRemovedBytes,\n totalSizeBeforeBytes: totalSizeBefore,\n totalSizeAfterBytes: totalSizeAfter,\n dryRun,\n };\n }\n\n /**\n * Record a removal in the prune report and, unless this is a dry run, actually delete it\n * (fast rename-to-trash). Keeps the \"report and delete are gated by the same dryRun flag\"\n * invariant in one place so the per-kind prune helpers can't drift apart.\n */\n private async recordRemoval(\n removed: PruneCapsulesReport['removed'],\n entry: PruneCapsulesReport['removed'][number],\n dryRun: boolean\n ): Promise<void> {\n removed.push(entry);\n this.logger.debug(\n `[capsule-prune] ${dryRun ? 'would remove' : 'removing'} [${entry.kind} · ${entry.reason}] ${entry.path}` +\n (entry.originPath ? ` origin=${entry.originPath}` : '')\n );\n if (!dryRun) await this.scheduleFastDelete(entry.path);\n }\n\n /**\n * The `dated-capsules` dir holds per-date subdirs (`YYYY-M-D`) of in-flight isolation\n * runs. These are recreated on every isolation, so anything that isn't *today*'s\n * subdir is leftover from a previous run and safe to delete. Today's subdir is\n * preserved to avoid racing a concurrent bit process that may still be writing to it.\n */\n private async pruneDatedCapsulesChildren(\n rootPath: string,\n dryRun: boolean,\n computeSizes: boolean,\n removed: PruneCapsulesReport['removed']\n ): Promise<void> {\n const todayDir = this.getDatedCapsuleDirName();\n let entries: fs.Dirent[];\n try {\n entries = await fs.readdir(rootPath, { withFileTypes: true });\n } catch {\n return;\n }\n for (const entry of entries) {\n if (!this.isPrunableSubdir(entry)) continue;\n if (entry.name === todayDir) continue;\n const childPath = path.join(rootPath, entry.name);\n const sizeBytes = computeSizes ? await this.computeDirSize(childPath) : 0;\n await this.recordRemoval(\n removed,\n { path: childPath, kind: 'unmarked', reason: 'dated-capsules-not-today', sizeBytes },\n dryRun\n );\n }\n }\n\n /**\n * Legacy unmarked dirs may still be a scope-aspects root. Heuristic: a child subdir whose\n * name contains `@` (aspect-version pattern like `teambit.node_node@1.3.4`).\n */\n private async looksLikeAspectsRoot(dir: string): Promise<boolean> {\n try {\n const entries = await fs.readdir(dir, { withFileTypes: true });\n return entries.some((e) => e.isDirectory() && e.name.includes('@'));\n } catch {\n return false;\n }\n }\n\n /**\n * Prune per-aspect-version children of a scope-aspects root purely by age (marker mtime,\n * which is touched on every aspect load).\n *\n * Note there's deliberately no orphan check here: a scope-aspect child's `originPath` is\n * the *logical* scope-aspects path (e.g. `<scope.path>-aspects`) used only to hash the\n * capsule root dir name — it need not exist as a real directory, so treating a missing\n * `originPath` as \"orphan\" would wrongly delete capsules of currently-used aspects.\n * Orphan pruning is still honored elsewhere for `workspace`/`scope` kinds.\n */\n private async pruneAspectsRootChildren(\n rootPath: string,\n ageCutoffMs: number,\n dryRun: boolean,\n computeSizes: boolean,\n removed: PruneCapsulesReport['removed']\n ): Promise<void> {\n let entries: fs.Dirent[];\n try {\n entries = await fs.readdir(rootPath, { withFileTypes: true });\n } catch {\n return;\n }\n for (const entry of entries) {\n if (!this.isPrunableSubdir(entry)) continue;\n const childPath = path.join(rootPath, entry.name);\n const { marker, lastUsedMs } = await this.readMarkerInfo(childPath);\n if (lastUsedMs < ageCutoffMs) {\n const sizeBytes = computeSizes ? await this.computeDirSize(childPath) : 0;\n await this.recordRemoval(\n removed,\n {\n path: childPath,\n kind: 'scope-aspect',\n reason: 'asp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IAAI,EAAE,cAAc;UACpBmE,MAAM,EAAE,0BAA0B;UAClC3B,SAAS;UACTnH,UAAU,EAAEH,MAAM,EAAEG;QACtB,CAAC,EACDkI,MACF,CAAC;MACH;IACF;EACF;AACF;AAACzJ,OAAA,CAAAW,YAAA,GAAAA,YAAA","ignoreList":[]}
@@ -1,5 +1,5 @@
1
- import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.component_isolator@1.0.1009/dist/isolator.composition.js';
2
- import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.component_isolator@1.0.1009/dist/isolator.docs.md';
1
+ import * as compositions_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.component_isolator@1.0.1010/dist/isolator.composition.js';
2
+ import * as overview_0 from '/home/circleci/Library/Caches/Bit/capsules/8891be5ad/teambit.component_isolator@1.0.1010/dist/isolator.docs.md';
3
3
 
4
4
  export const compositions = [compositions_0];
5
5
  export const overview = [overview_0];
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@teambit/isolator",
3
- "version": "1.0.1009",
3
+ "version": "1.0.1010",
4
4
  "homepage": "https://bit.cloud/teambit/component/isolator",
5
5
  "main": "dist/index.js",
6
6
  "componentId": {
7
7
  "scope": "teambit.component",
8
8
  "name": "isolator",
9
- "version": "1.0.1009"
9
+ "version": "1.0.1010"
10
10
  },
11
11
  "dependencies": {
12
12
  "fs-extra": "10.0.0",
@@ -23,29 +23,29 @@
23
23
  "glob": "13.0.0",
24
24
  "debug": "4.3.4",
25
25
  "execa": "2.1.0",
26
- "@teambit/cli": "0.0.1333",
27
- "@teambit/config-store": "0.0.214",
28
- "@teambit/harmony.modules.concurrency": "0.0.30",
29
- "@teambit/harmony.modules.feature-toggle": "0.0.39",
30
- "@teambit/legacy.constants": "0.0.29",
31
- "@teambit/logger": "0.0.1426",
32
26
  "@teambit/component-id": "1.2.4",
33
27
  "@teambit/graph.cleargraph": "0.0.11",
34
28
  "@teambit/harmony": "0.4.7",
35
29
  "@teambit/component-package-version": "0.0.450",
36
- "@teambit/component.sources": "0.0.175",
37
- "@teambit/dependencies.fs.linked-dependencies": "0.0.55",
38
- "@teambit/global-config": "0.0.1337",
39
- "@teambit/legacy.consumer-component": "0.0.124",
40
- "@teambit/legacy.scope": "0.0.123",
41
30
  "@teambit/legacy.utils": "0.0.38",
42
- "@teambit/pkg.modules.component-package-name": "0.0.130",
43
- "@teambit/workspace.modules.node-modules-linker": "0.0.354",
44
- "@teambit/component": "1.0.1009",
45
- "@teambit/dependency-resolver": "1.0.1009",
46
- "@teambit/aspect-loader": "1.0.1009",
47
- "@teambit/graph": "1.0.1009",
48
- "@teambit/objects": "0.0.516"
31
+ "@teambit/cli": "0.0.1334",
32
+ "@teambit/config-store": "0.0.215",
33
+ "@teambit/harmony.modules.concurrency": "0.0.31",
34
+ "@teambit/harmony.modules.feature-toggle": "0.0.40",
35
+ "@teambit/legacy.constants": "0.0.30",
36
+ "@teambit/logger": "0.0.1427",
37
+ "@teambit/component": "1.0.1010",
38
+ "@teambit/dependency-resolver": "1.0.1010",
39
+ "@teambit/aspect-loader": "1.0.1010",
40
+ "@teambit/component.sources": "0.0.176",
41
+ "@teambit/dependencies.fs.linked-dependencies": "0.0.56",
42
+ "@teambit/global-config": "0.0.1338",
43
+ "@teambit/graph": "1.0.1010",
44
+ "@teambit/legacy.consumer-component": "0.0.125",
45
+ "@teambit/legacy.scope": "0.0.124",
46
+ "@teambit/objects": "0.0.517",
47
+ "@teambit/pkg.modules.component-package-name": "0.0.131",
48
+ "@teambit/workspace.modules.node-modules-linker": "0.0.355"
49
49
  },
50
50
  "devDependencies": {
51
51
  "@types/fs-extra": "9.0.7",