node-env-resolver-dotenvx 2.0.2 → 3.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/dist/handlers.d.ts +6 -8
- package/dist/handlers.d.ts.map +1 -0
- package/dist/index.d.ts +10 -13
- package/dist/index.d.ts.map +1 -0
- package/package.json +12 -18
- package/dist/handlers.d.cts +0 -48
- package/dist/index.d.cts +0 -146
package/dist/handlers.d.ts
CHANGED
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
import { ReferenceHandler } from 'node-env-resolver';
|
|
2
|
-
|
|
3
1
|
/**
|
|
4
2
|
* Keychain reference handler for node-env-resolver
|
|
5
3
|
*
|
|
@@ -27,8 +25,8 @@ import { ReferenceHandler } from 'node-env-resolver';
|
|
|
27
25
|
* .env file:
|
|
28
26
|
* DATABASE_URL=keychain://prod/database-url
|
|
29
27
|
*/
|
|
30
|
-
|
|
31
|
-
interface KeychainHandlerOptions {
|
|
28
|
+
import type { ReferenceHandler } from 'node-env-resolver';
|
|
29
|
+
export interface KeychainHandlerOptions {
|
|
32
30
|
/** macOS Keychain service name prefix (default: 'node-env-resolver') */
|
|
33
31
|
servicePrefix?: string;
|
|
34
32
|
/** Platform override: 'macos' | 'linux' | 'windows' | 'auto' (default: 'auto') */
|
|
@@ -41,8 +39,8 @@ interface KeychainDeps {
|
|
|
41
39
|
timeout: number;
|
|
42
40
|
}) => string;
|
|
43
41
|
}
|
|
44
|
-
declare function createKeychainHandler(options?: KeychainHandlerOptions, deps?: Partial<KeychainDeps>): ReferenceHandler;
|
|
42
|
+
export declare function createKeychainHandler(options?: KeychainHandlerOptions, deps?: Partial<KeychainDeps>): ReferenceHandler;
|
|
45
43
|
/** Pre-configured keychain handler using auto-detected platform */
|
|
46
|
-
declare const keychainHandler: ReferenceHandler;
|
|
47
|
-
|
|
48
|
-
|
|
44
|
+
export declare const keychainHandler: ReferenceHandler;
|
|
45
|
+
export {};
|
|
46
|
+
//# sourceMappingURL=handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../src/handlers.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AAGH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE1D,MAAM,WAAW,sBAAsB;IACrC,wEAAwE;IACxE,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,kFAAkF;IAClF,QAAQ,CAAC,EAAE,OAAO,GAAG,OAAO,GAAG,SAAS,GAAG,MAAM,CAAC;CACnD;AAED,UAAU,YAAY;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE;QAAE,QAAQ,EAAE,OAAO,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,KAAK,MAAM,CAAC;CAC5G;AA4HD,wBAAgB,qBAAqB,CACnC,OAAO,GAAE,sBAA2B,EACpC,IAAI,CAAC,EAAE,OAAO,CAAC,YAAY,CAAC,GAC3B,gBAAgB,CA6DlB;AAED,mEAAmE;AACnE,eAAO,MAAM,eAAe,kBAA0B,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import { Resolver, SimpleEnvSchema, ResolveOptions, InferSimpleSchema, SafeResolveResultType } from 'node-env-resolver';
|
|
2
|
-
export { resolveAsync, safeResolveAsync } from 'node-env-resolver';
|
|
3
|
-
export { processEnv } from 'node-env-resolver/resolvers';
|
|
4
|
-
export { KeychainHandlerOptions, createKeychainHandler, keychainHandler } from './handlers.js';
|
|
5
|
-
|
|
6
1
|
/**
|
|
7
2
|
* Dotenvx resolvers for node-env-resolver
|
|
8
3
|
* Supports encrypted .env file loading via @dotenvx/dotenvx
|
|
9
4
|
*/
|
|
10
|
-
|
|
5
|
+
import type { Resolver, SimpleEnvSchema, InferSimpleSchema, ResolveOptions, SafeResolveResultType } from 'node-env-resolver';
|
|
6
|
+
export { resolveAsync, safeResolveAsync } from 'node-env-resolver';
|
|
7
|
+
export { processEnv } from 'node-env-resolver/resolvers';
|
|
8
|
+
export { createKeychainHandler, keychainHandler, type KeychainHandlerOptions, } from './handlers';
|
|
11
9
|
/**
|
|
12
10
|
* Options for the dotenvx resolver
|
|
13
11
|
*/
|
|
14
|
-
interface DotenvxOptions {
|
|
12
|
+
export interface DotenvxOptions {
|
|
15
13
|
/** Path to the encrypted .env file (default: '.env') */
|
|
16
14
|
path?: string;
|
|
17
15
|
/** Override existing env vars with values from the file (default: false) */
|
|
@@ -76,7 +74,7 @@ interface DotenvxDeps {
|
|
|
76
74
|
* });
|
|
77
75
|
* ```
|
|
78
76
|
*/
|
|
79
|
-
declare function dotenvx(options?: string | DotenvxOptions, deps?: Partial<DotenvxDeps>): Resolver;
|
|
77
|
+
export declare function dotenvx(options?: string | DotenvxOptions, deps?: Partial<DotenvxDeps>): Resolver;
|
|
80
78
|
/**
|
|
81
79
|
* Load multiple encrypted .env files in order (like the keychain pattern)
|
|
82
80
|
*
|
|
@@ -100,7 +98,7 @@ declare function dotenvx(options?: string | DotenvxOptions, deps?: Partial<Doten
|
|
|
100
98
|
* });
|
|
101
99
|
* ```
|
|
102
100
|
*/
|
|
103
|
-
declare function dotenvxKeychain(options?: {
|
|
101
|
+
export declare function dotenvxKeychain(options?: {
|
|
104
102
|
/** Path to plain env file (default: '.env.local') */
|
|
105
103
|
plainPath?: string;
|
|
106
104
|
/** Path to encrypted secrets file (default: '.env.local.secrets') */
|
|
@@ -123,7 +121,7 @@ declare function dotenvxKeychain(options?: {
|
|
|
123
121
|
* );
|
|
124
122
|
* ```
|
|
125
123
|
*/
|
|
126
|
-
declare function resolveDotenvx<T extends SimpleEnvSchema>(dotenvxOptions: string | DotenvxOptions, schema: T, resolveOptions?: Partial<ResolveOptions>, deps?: Partial<DotenvxDeps>): Promise<InferSimpleSchema<T>>;
|
|
124
|
+
export declare function resolveDotenvx<T extends SimpleEnvSchema>(dotenvxOptions: string | DotenvxOptions, schema: T, resolveOptions?: Partial<ResolveOptions>, deps?: Partial<DotenvxDeps>): Promise<InferSimpleSchema<T>>;
|
|
127
125
|
/**
|
|
128
126
|
* Safe version of resolveDotenvx that doesn't throw errors
|
|
129
127
|
*
|
|
@@ -141,6 +139,5 @@ declare function resolveDotenvx<T extends SimpleEnvSchema>(dotenvxOptions: strin
|
|
|
141
139
|
* }
|
|
142
140
|
* ```
|
|
143
141
|
*/
|
|
144
|
-
declare function safeResolveDotenvx<T extends SimpleEnvSchema>(dotenvxOptions: string | DotenvxOptions, schema: T, resolveOptions?: Partial<ResolveOptions>, deps?: Partial<DotenvxDeps>): Promise<SafeResolveResultType<InferSimpleSchema<T>>>;
|
|
145
|
-
|
|
146
|
-
export { type DotenvxOptions, dotenvx, dotenvxKeychain, resolveDotenvx, safeResolveDotenvx };
|
|
142
|
+
export declare function safeResolveDotenvx<T extends SimpleEnvSchema>(dotenvxOptions: string | DotenvxOptions, schema: T, resolveOptions?: Partial<ResolveOptions>, deps?: Partial<DotenvxDeps>): Promise<SafeResolveResultType<InferSimpleSchema<T>>>;
|
|
143
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "node-env-resolver-dotenvx",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "3.0.1",
|
|
4
4
|
"description": "Dotenvx and OS Keychain resolvers for node-env-resolver (encrypted .env files, keychain:// secret references)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -60,33 +60,27 @@
|
|
|
60
60
|
"node": ">=18"
|
|
61
61
|
},
|
|
62
62
|
"dependencies": {
|
|
63
|
-
"@dotenvx/dotenvx": "^
|
|
63
|
+
"@dotenvx/dotenvx": "^2.38.2"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"node-env-resolver": "^6.
|
|
66
|
+
"node-env-resolver": "^6.7.0"
|
|
67
67
|
},
|
|
68
68
|
"publishConfig": {
|
|
69
69
|
"access": "public"
|
|
70
70
|
},
|
|
71
71
|
"devDependencies": {
|
|
72
|
-
"@
|
|
73
|
-
"
|
|
74
|
-
"
|
|
75
|
-
"
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"prettier": "^3.8.2",
|
|
79
|
-
"tsup": "^8.5.1",
|
|
80
|
-
"typescript": "^6.0.2",
|
|
81
|
-
"vitest": "^4.1.4",
|
|
82
|
-
"node-env-resolver": "6.5.2"
|
|
72
|
+
"@types/node": "^26.6.5",
|
|
73
|
+
"prettier": "^3.9.10",
|
|
74
|
+
"tsup": "^9.0.0",
|
|
75
|
+
"typescript": "^7.0.2",
|
|
76
|
+
"vitest": "^5.0.5",
|
|
77
|
+
"node-env-resolver": "6.7.0"
|
|
83
78
|
},
|
|
84
79
|
"scripts": {
|
|
85
|
-
"build": "NODE_ENV=production tsup",
|
|
86
|
-
"build:dev": "tsup",
|
|
87
|
-
"build:dts": "tsc
|
|
80
|
+
"build": "NODE_ENV=production tsup && tsc -p tsconfig.build.json",
|
|
81
|
+
"build:dev": "tsup && tsc -p tsconfig.build.json",
|
|
82
|
+
"build:dts": "tsc -p tsconfig.build.json",
|
|
88
83
|
"type-check": "tsc -p tsconfig.json --noEmit",
|
|
89
|
-
"lint": "eslint src/",
|
|
90
84
|
"test": "vitest run",
|
|
91
85
|
"format": "prettier --write \"**/*.{ts,tsx,md}\""
|
|
92
86
|
}
|
package/dist/handlers.d.cts
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { ReferenceHandler } from 'node-env-resolver';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Keychain reference handler for node-env-resolver
|
|
5
|
-
*
|
|
6
|
-
* Resolves `keychain://` URI references by fetching secrets
|
|
7
|
-
* from the OS credential store (macOS Keychain, Linux secret-tool, Windows Credential Manager).
|
|
8
|
-
*
|
|
9
|
-
* @example
|
|
10
|
-
* ```ts
|
|
11
|
-
* import { resolveAsync } from 'node-env-resolver';
|
|
12
|
-
* import { processEnv } from 'node-env-resolver/resolvers';
|
|
13
|
-
* import { createKeychainHandler } from 'node-env-resolver-dotenvx/handlers';
|
|
14
|
-
*
|
|
15
|
-
* const config = await resolveAsync({
|
|
16
|
-
* resolvers: [[processEnv(), {
|
|
17
|
-
* DATABASE_URL: string(), // value can be 'keychain://prod/database-url'
|
|
18
|
-
* }]],
|
|
19
|
-
* references: {
|
|
20
|
-
* handlers: {
|
|
21
|
-
* 'keychain': createKeychainHandler(),
|
|
22
|
-
* },
|
|
23
|
-
* },
|
|
24
|
-
* });
|
|
25
|
-
* ```
|
|
26
|
-
*
|
|
27
|
-
* .env file:
|
|
28
|
-
* DATABASE_URL=keychain://prod/database-url
|
|
29
|
-
*/
|
|
30
|
-
|
|
31
|
-
interface KeychainHandlerOptions {
|
|
32
|
-
/** macOS Keychain service name prefix (default: 'node-env-resolver') */
|
|
33
|
-
servicePrefix?: string;
|
|
34
|
-
/** Platform override: 'macos' | 'linux' | 'windows' | 'auto' (default: 'auto') */
|
|
35
|
-
platform?: 'macos' | 'linux' | 'windows' | 'auto';
|
|
36
|
-
}
|
|
37
|
-
interface KeychainDeps {
|
|
38
|
-
platform: string;
|
|
39
|
-
execFileSync: (command: string, args: string[], options: {
|
|
40
|
-
encoding: 'utf-8';
|
|
41
|
-
timeout: number;
|
|
42
|
-
}) => string;
|
|
43
|
-
}
|
|
44
|
-
declare function createKeychainHandler(options?: KeychainHandlerOptions, deps?: Partial<KeychainDeps>): ReferenceHandler;
|
|
45
|
-
/** Pre-configured keychain handler using auto-detected platform */
|
|
46
|
-
declare const keychainHandler: ReferenceHandler;
|
|
47
|
-
|
|
48
|
-
export { type KeychainHandlerOptions, createKeychainHandler, keychainHandler };
|
package/dist/index.d.cts
DELETED
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { Resolver, SimpleEnvSchema, ResolveOptions, InferSimpleSchema, SafeResolveResultType } from 'node-env-resolver';
|
|
2
|
-
export { resolveAsync, safeResolveAsync } from 'node-env-resolver';
|
|
3
|
-
export { processEnv } from 'node-env-resolver/resolvers';
|
|
4
|
-
export { KeychainHandlerOptions, createKeychainHandler, keychainHandler } from './handlers.cjs';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Dotenvx resolvers for node-env-resolver
|
|
8
|
-
* Supports encrypted .env file loading via @dotenvx/dotenvx
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* Options for the dotenvx resolver
|
|
13
|
-
*/
|
|
14
|
-
interface DotenvxOptions {
|
|
15
|
-
/** Path to the encrypted .env file (default: '.env') */
|
|
16
|
-
path?: string;
|
|
17
|
-
/** Override existing env vars with values from the file (default: false) */
|
|
18
|
-
overload?: boolean;
|
|
19
|
-
/** Custom path to .env.keys file */
|
|
20
|
-
envKeysFile?: string;
|
|
21
|
-
/** Private key for decryption (can also be set via DOTENV_PRIVATE_KEY env var) */
|
|
22
|
-
privateKey?: string;
|
|
23
|
-
}
|
|
24
|
-
interface DotenvxConfigResult {
|
|
25
|
-
parsed?: Record<string, string>;
|
|
26
|
-
error?: Error;
|
|
27
|
-
}
|
|
28
|
-
interface DotenvxDeps {
|
|
29
|
-
existsSync: (path: string) => boolean;
|
|
30
|
-
resolvePath: (...paths: string[]) => string;
|
|
31
|
-
cwd: () => string;
|
|
32
|
-
dotenvxConfig: (options: Record<string, unknown>) => DotenvxConfigResult;
|
|
33
|
-
resolveAsync: (config: {
|
|
34
|
-
resolvers: unknown;
|
|
35
|
-
options?: unknown;
|
|
36
|
-
}) => Promise<Record<string, unknown>>;
|
|
37
|
-
safeResolveAsync: (config: {
|
|
38
|
-
resolvers: unknown;
|
|
39
|
-
options?: unknown;
|
|
40
|
-
}) => Promise<{
|
|
41
|
-
success: boolean;
|
|
42
|
-
data?: Record<string, unknown>;
|
|
43
|
-
error?: string;
|
|
44
|
-
}>;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Load configuration from encrypted .env files using dotenvx
|
|
48
|
-
*
|
|
49
|
-
* Decrypts .env files that were encrypted with `dotenvx encrypt`.
|
|
50
|
-
* The decryption key can be provided via:
|
|
51
|
-
* - privateKey option
|
|
52
|
-
* - DOTENV_PRIVATE_KEY env var (or file-specific key like DOTENV_PRIVATE_KEY_STAGING)
|
|
53
|
-
* - .env.keys file (default location or custom via envKeysFile option)
|
|
54
|
-
*
|
|
55
|
-
* @param options Path string or options object
|
|
56
|
-
* @returns Resolver that loads and decrypts dotenvx-encrypted files
|
|
57
|
-
*
|
|
58
|
-
* @example
|
|
59
|
-
* ```ts
|
|
60
|
-
* import { resolveAsync } from 'node-env-resolver';
|
|
61
|
-
* import { dotenvx } from 'node-env-resolver-dotenvx';
|
|
62
|
-
*
|
|
63
|
-
* // Load encrypted .env.local.secrets
|
|
64
|
-
* const config = await resolveAsync({
|
|
65
|
-
* resolvers: [
|
|
66
|
-
* [dotenvx('.env.local.secrets'), { DB_PASSWORD: string() }]
|
|
67
|
-
* ]
|
|
68
|
-
* });
|
|
69
|
-
*
|
|
70
|
-
* // With private key from OS keychain (see keychain handler)
|
|
71
|
-
* process.env.DOTENV_PRIVATE_KEY = await getKeyFromKeychain();
|
|
72
|
-
* const config = await resolveAsync({
|
|
73
|
-
* resolvers: [
|
|
74
|
-
* [dotenvx({ path: '.env.local.secrets', overload: true }), { DB_PASSWORD: string() }]
|
|
75
|
-
* ]
|
|
76
|
-
* });
|
|
77
|
-
* ```
|
|
78
|
-
*/
|
|
79
|
-
declare function dotenvx(options?: string | DotenvxOptions, deps?: Partial<DotenvxDeps>): Resolver;
|
|
80
|
-
/**
|
|
81
|
-
* Load multiple encrypted .env files in order (like the keychain pattern)
|
|
82
|
-
*
|
|
83
|
-
* Loads plain env files first (non-encrypted), then decrypts secrets file.
|
|
84
|
-
* This matches the pattern from the dotenvx keychain blog post:
|
|
85
|
-
* 1. Load .env.local (plain config)
|
|
86
|
-
* 2. Load .env.local.secrets (encrypted by dotenvx)
|
|
87
|
-
*
|
|
88
|
-
* @param options Configuration for which files to load
|
|
89
|
-
* @returns Resolver that loads and merges multiple env files
|
|
90
|
-
*
|
|
91
|
-
* @example
|
|
92
|
-
* ```ts
|
|
93
|
-
* import { resolveAsync } from 'node-env-resolver';
|
|
94
|
-
* import { dotenvxKeychain } from 'node-env-resolver-dotenvx';
|
|
95
|
-
*
|
|
96
|
-
* const config = await resolveAsync({
|
|
97
|
-
* resolvers: [
|
|
98
|
-
* [dotenvxKeychain(), { DB_PASSWORD: string(), DEBUG: false }]
|
|
99
|
-
* ]
|
|
100
|
-
* });
|
|
101
|
-
* ```
|
|
102
|
-
*/
|
|
103
|
-
declare function dotenvxKeychain(options?: {
|
|
104
|
-
/** Path to plain env file (default: '.env.local') */
|
|
105
|
-
plainPath?: string;
|
|
106
|
-
/** Path to encrypted secrets file (default: '.env.local.secrets') */
|
|
107
|
-
secretsPath?: string;
|
|
108
|
-
/** Override env vars from secrets file (default: true — secrets override plain) */
|
|
109
|
-
overload?: boolean;
|
|
110
|
-
/** Private key for decryption */
|
|
111
|
-
privateKey?: string;
|
|
112
|
-
/** Custom path to .env.keys file */
|
|
113
|
-
envKeysFile?: string;
|
|
114
|
-
}, deps?: Partial<DotenvxDeps>): Resolver;
|
|
115
|
-
/**
|
|
116
|
-
* Resolve environment variables using dotenvx-encrypted files
|
|
117
|
-
*
|
|
118
|
-
* @example
|
|
119
|
-
* ```ts
|
|
120
|
-
* const config = await resolveDotenvx(
|
|
121
|
-
* { path: '.env.local.secrets' },
|
|
122
|
-
* { DB_PASSWORD: string(), API_KEY: string() }
|
|
123
|
-
* );
|
|
124
|
-
* ```
|
|
125
|
-
*/
|
|
126
|
-
declare function resolveDotenvx<T extends SimpleEnvSchema>(dotenvxOptions: string | DotenvxOptions, schema: T, resolveOptions?: Partial<ResolveOptions>, deps?: Partial<DotenvxDeps>): Promise<InferSimpleSchema<T>>;
|
|
127
|
-
/**
|
|
128
|
-
* Safe version of resolveDotenvx that doesn't throw errors
|
|
129
|
-
*
|
|
130
|
-
* @example
|
|
131
|
-
* ```ts
|
|
132
|
-
* const result = await safeResolveDotenvx(
|
|
133
|
-
* { path: '.env.local.secrets' },
|
|
134
|
-
* { DB_PASSWORD: string() }
|
|
135
|
-
* );
|
|
136
|
-
*
|
|
137
|
-
* if (result.success) {
|
|
138
|
-
* console.log(result.data.DB_PASSWORD);
|
|
139
|
-
* } else {
|
|
140
|
-
* console.error(result.error);
|
|
141
|
-
* }
|
|
142
|
-
* ```
|
|
143
|
-
*/
|
|
144
|
-
declare function safeResolveDotenvx<T extends SimpleEnvSchema>(dotenvxOptions: string | DotenvxOptions, schema: T, resolveOptions?: Partial<ResolveOptions>, deps?: Partial<DotenvxDeps>): Promise<SafeResolveResultType<InferSimpleSchema<T>>>;
|
|
145
|
-
|
|
146
|
-
export { type DotenvxOptions, dotenvx, dotenvxKeychain, resolveDotenvx, safeResolveDotenvx };
|