@gajae-code/utils 0.1.3 → 0.2.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.
@@ -30,6 +30,7 @@ export declare function parseShellEnvFile(filePath: string): Record<string, stri
30
30
  * Returns an object of key-value pairs.
31
31
  */
32
32
  export declare function parseEnvFile(filePath: string): Record<string, string>;
33
+ export declare function $inheritedEnv(name: string): string | undefined;
33
34
  /**
34
35
  * Intentional re-export of Bun.env.
35
36
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "type": "module",
3
3
  "name": "@gajae-code/utils",
4
- "version": "0.1.3",
4
+ "version": "0.2.1",
5
5
  "description": "Shared utilities for pi packages",
6
6
  "homepage": "https://gaebal-gajae.dev",
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.1.3",
34
+ "@gajae-code/natives": "0.2.1",
35
35
  "beautiful-mermaid": "^1.1.3",
36
36
  "handlebars": "^4.7.9",
37
37
  "winston": "^3.19.0",
package/src/env.ts CHANGED
@@ -135,6 +135,16 @@ export function parseEnvFile(filePath: string): Record<string, string> {
135
135
  return result;
136
136
  }
137
137
 
138
+ const inheritedEnv = filterProcessEnv(Bun.env);
139
+
140
+ export function $inheritedEnv(name: string): string | undefined {
141
+ if (!isSafeEnvName(name)) return undefined;
142
+ const value = inheritedEnv[name];
143
+ if (value === undefined || !isSafeEnvValue(value)) return undefined;
144
+ const trimmed = value.trim();
145
+ return trimmed.length > 0 ? trimmed : undefined;
146
+ }
147
+
138
148
  // Eagerly parse the user's $HOME/.env and the current project's .env (from cwd)
139
149
  const homeShellEnv = {
140
150
  ...parseShellEnvFile(path.join(os.homedir(), ".zshenv")),