@gajae-code/utils 0.12.7 → 0.12.10

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@gajae-code/utils",
4
- "version": "0.12.7",
4
+ "version": "0.12.10",
5
5
  "description": "Shared utilities for pi packages",
6
6
  "homepage": "https://gajae-code.com",
7
7
  "author": "Yeachan-Heo",
@@ -31,7 +31,7 @@
31
31
  "fmt": "biome format --write ."
32
32
  },
33
33
  "dependencies": {
34
- "@gajae-code/natives": "0.12.7",
34
+ "@gajae-code/natives": "0.12.10",
35
35
  "beautiful-mermaid": "^1.1.3",
36
36
  "handlebars": "^4.7.9",
37
37
  "winston": "^3.19.0",
package/src/postmortem.ts CHANGED
@@ -433,12 +433,12 @@ export function register(id: string, callback: (reason: Reason) => void | Promis
433
433
  }
434
434
  // If cleanup is already running/completed, warn and run on microtask.
435
435
  logger.warn("Cleanup invoked recursively", { id });
436
- try {
437
- callback(Reason.MANUAL);
438
- } catch (error) {
439
- const err = error instanceof Error ? error : new Error(String(error));
440
- logger.error("Cleanup callback failed", { err, id, stack: err.stack });
441
- }
436
+ queueMicrotask(() => {
437
+ void Promise.try(() => exec(Reason.MANUAL)).catch(error => {
438
+ const err = error instanceof Error ? error : new Error(String(error));
439
+ logger.error("Cleanup callback failed", { err, id, stack: err.stack });
440
+ });
441
+ });
442
442
  return () => {};
443
443
  }
444
444
 
package/src/which.ts CHANGED
@@ -183,9 +183,10 @@ export interface WhichOptions extends Bun.WhichOptions {
183
183
 
184
184
  // Darwin-specific "which" shim: consult Xcode/CLT toolchain directories after $PATH.
185
185
  // Uses cached directory listings instead of per-command existsSync or xcrun subprocesses.
186
- function darwinWhich(command: string, _options?: Bun.WhichOptions): string | null {
187
- const regular = Bun.which(command);
186
+ function darwinWhich(command: string, options?: Bun.WhichOptions): string | null {
187
+ const regular = Bun.which(command, options);
188
188
  if (regular) return regular;
189
+ if (options?.PATH !== undefined) return null;
189
190
  if (isXcodeBin(command)) {
190
191
  return getMacosToolPaths().get(command) ?? null;
191
192
  }
@@ -198,10 +199,10 @@ export const whichFresh = os.platform() === "darwin" ? darwinWhich : Bun.which;
198
199
  // Derive stable cache key from command and lookup options
199
200
  function cacheKey(command: string, options?: Bun.WhichOptions): CacheKey {
200
201
  if (!options) return command;
201
- if (!options.cwd && !options.PATH) return command;
202
+ if (options.cwd === undefined && options.PATH === undefined) return command;
202
203
  let h = Bun.hash(command);
203
- if (options.cwd) h = Bun.hash(options.cwd, h);
204
- if (options.PATH) h = Bun.hash(options.PATH, h);
204
+ if (options.cwd !== undefined) h = Bun.hash(`cwd:${options.cwd}`, h);
205
+ if (options.PATH !== undefined) h = Bun.hash(`PATH:${options.PATH}`, h);
205
206
  return h;
206
207
  }
207
208