@gajae-code/utils 0.12.1 → 0.12.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.
Files changed (2) hide show
  1. package/package.json +2 -2
  2. package/src/env.ts +11 -1
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@gajae-code/utils",
4
- "version": "0.12.1",
4
+ "version": "0.12.2",
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.1",
34
+ "@gajae-code/natives": "0.12.2",
35
35
  "beautiful-mermaid": "^1.1.3",
36
36
  "handlebars": "^4.7.9",
37
37
  "winston": "^3.19.0",
package/src/env.ts CHANGED
@@ -52,7 +52,17 @@ const projectEnv = parseEnvFile(path.join(process.cwd(), ".env"));
52
52
  const inheritedEnv = filterCredentialInheritedEnv(Bun.env);
53
53
 
54
54
  export function $inheritedEnv(name: string): string | undefined {
55
- return resolveFileEnvValue(inheritedEnv, name);
55
+ const snapshotValue = resolveFileEnvValue(inheritedEnv, name);
56
+ if (snapshotValue === undefined) return undefined;
57
+ // The snapshot records provenance — this key was inherited from the launching
58
+ // shell rather than the caller's cwd/.env — and pins the value so a later
59
+ // in-process write cannot swap the credential we authenticate with. It is not
60
+ // a cache that outlives the variable: once the key is removed from the live
61
+ // environment it is no longer inherited, so deletion is honoured. Without
62
+ // this, a credential present at import time can never be suppressed (tests
63
+ // that clear provider env vars silently keep resolving the real credential).
64
+ if (Bun.env[name] === undefined) return undefined;
65
+ return snapshotValue;
56
66
  }
57
67
 
58
68
  function resolveLiveCredentialEnvValue(name: string): string | undefined {