varlock 0.0.11 → 0.0.13
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/{chunk-FYLMYWUF.js → chunk-5EBVEGDW.js} +5 -24
- package/dist/chunk-5EBVEGDW.js.map +1 -0
- package/dist/{chunk-4CE75BSX.js → chunk-AS4LIW7A.js} +21 -15
- package/dist/chunk-AS4LIW7A.js.map +1 -0
- package/dist/{chunk-KCX4NC7Q.js → chunk-IML4QZHB.js} +4 -5
- package/dist/chunk-IML4QZHB.js.map +1 -0
- package/dist/{chunk-4WMY2EW3.js → chunk-LXJMZMID.js} +98 -66
- package/dist/chunk-LXJMZMID.js.map +1 -0
- package/dist/{chunk-ZW2T4C6A.js → chunk-MV5ZAKN7.js} +539 -267
- package/dist/chunk-MV5ZAKN7.js.map +1 -0
- package/dist/{chunk-LS6F7BSZ.js → chunk-MVYXWTAV.js} +4 -4
- package/dist/{chunk-LS6F7BSZ.js.map → chunk-MVYXWTAV.js.map} +1 -1
- package/dist/{chunk-PB7RWVE6.js → chunk-T3I4UFB2.js} +16 -5
- package/dist/chunk-T3I4UFB2.js.map +1 -0
- package/dist/{chunk-GWQT5VGW.js → chunk-UA3DMAAQ.js} +4 -4
- package/dist/{chunk-GWQT5VGW.js.map → chunk-UA3DMAAQ.js.map} +1 -1
- package/dist/cli/cli-executable.js +14 -15
- package/dist/cli/cli-executable.js.map +1 -1
- package/dist/{env-KH4bPru7.d.ts → env-B_LAqK4w.d.ts} +103 -64
- package/dist/index.d.ts +2 -3
- package/dist/index.js +2 -4
- package/dist/index.js.map +1 -1
- package/dist/init.command-CTO64XBL.js +8 -0
- package/dist/{init.command-ZRQOE2OK.js.map → init.command-CTO64XBL.js.map} +1 -1
- package/dist/load.command-EWIJDF55.js +8 -0
- package/dist/{load.command-YBN3BW6U.js.map → load.command-EWIJDF55.js.map} +1 -1
- package/dist/login.command-UZJJ4XTV.js +8 -0
- package/dist/{login.command-F5AWKZKA.js.map → login.command-UZJJ4XTV.js.map} +1 -1
- package/dist/run.command-T44BAZ7X.js +8 -0
- package/dist/{run.command-WWJ6ZE26.js.map → run.command-T44BAZ7X.js.map} +1 -1
- package/dist/runtime/env.d.ts +1 -1
- package/dist/telemetry.command-2C3MQA4K.js +8 -0
- package/dist/{telemetry.command-IS2JLIZM.js.map → telemetry.command-2C3MQA4K.js.map} +1 -1
- package/package.json +3 -3
- package/dist/chunk-4CE75BSX.js.map +0 -1
- package/dist/chunk-4WMY2EW3.js.map +0 -1
- package/dist/chunk-FYLMYWUF.js.map +0 -1
- package/dist/chunk-KCX4NC7Q.js.map +0 -1
- package/dist/chunk-PB7RWVE6.js.map +0 -1
- package/dist/chunk-ZUG7BEY5.js +0 -17
- package/dist/chunk-ZUG7BEY5.js.map +0 -1
- package/dist/chunk-ZW2T4C6A.js.map +0 -1
- package/dist/init.command-ZRQOE2OK.js +0 -9
- package/dist/load.command-YBN3BW6U.js +0 -9
- package/dist/login.command-F5AWKZKA.js +0 -8
- package/dist/run.command-WWJ6ZE26.js +0 -9
- package/dist/telemetry.command-IS2JLIZM.js +0 -8
|
@@ -113,73 +113,120 @@ declare function createEnvGraphDataType<TsType, InstanceSettingsArgs extends Arr
|
|
|
113
113
|
};
|
|
114
114
|
type EnvGraphDataTypeFactory = ReturnType<typeof createEnvGraphDataType>;
|
|
115
115
|
|
|
116
|
+
type ResolvedValue = undefined | string | number | boolean | RegExp;
|
|
117
|
+
type ResolverFunctionArgs = Array<Resolver | Record<string, Resolver>>;
|
|
118
|
+
declare abstract class Resolver {
|
|
119
|
+
readonly fnArgs: ResolverFunctionArgs;
|
|
120
|
+
static fnName?: string;
|
|
121
|
+
constructor(fnArgs: ResolverFunctionArgs);
|
|
122
|
+
abstract label: string;
|
|
123
|
+
abstract icon: string;
|
|
124
|
+
inferredType?: string;
|
|
125
|
+
_schemaErrors: Array<SchemaError>;
|
|
126
|
+
private _depsObj;
|
|
127
|
+
get childResolvers(): Array<Resolver>;
|
|
128
|
+
get schemaErrors(): Array<SchemaError>;
|
|
129
|
+
get depsObj(): Record<string, boolean>;
|
|
130
|
+
get deps(): string[];
|
|
131
|
+
protected abstract _process(ctx?: any): Promise<void | (() => void)>;
|
|
132
|
+
private configItem?;
|
|
133
|
+
process(configItem: ConfigItem): Promise<void>;
|
|
134
|
+
protected addDep(key: string): void;
|
|
135
|
+
protected abstract _resolve(): Promise<ResolvedValue>;
|
|
136
|
+
resolve(): Promise<ResolvedValue>;
|
|
137
|
+
protected getDepValue(key: string): ResolvedValue;
|
|
138
|
+
}
|
|
139
|
+
type ResolverChildClass<ChildClass extends Resolver = Resolver> = ({
|
|
140
|
+
new (...args: Array<any>): ChildClass;
|
|
141
|
+
} & typeof Resolver);
|
|
142
|
+
|
|
116
143
|
declare const DATA_SOURCE_TYPES: Readonly<{
|
|
117
144
|
schema: {
|
|
118
145
|
fileSuffixes: string[];
|
|
119
|
-
precedence: number;
|
|
120
146
|
};
|
|
121
147
|
example: {
|
|
122
148
|
fileSuffixes: string[];
|
|
123
|
-
precedence: number;
|
|
124
149
|
};
|
|
125
150
|
defaults: {
|
|
126
151
|
fileSuffixes: string[];
|
|
127
|
-
precedence: number;
|
|
128
152
|
};
|
|
129
153
|
values: {
|
|
130
154
|
fileSuffixes: Array<string>;
|
|
131
|
-
precedence: number;
|
|
132
155
|
};
|
|
133
156
|
overrides: {
|
|
134
157
|
fileSuffixes: string[];
|
|
135
|
-
precedence: number;
|
|
136
158
|
};
|
|
159
|
+
container: {};
|
|
137
160
|
}>;
|
|
138
161
|
type DataSourceType = keyof typeof DATA_SOURCE_TYPES;
|
|
139
162
|
declare abstract class EnvGraphDataSource {
|
|
140
163
|
static DATA_SOURCE_TYPES: Readonly<{
|
|
141
164
|
schema: {
|
|
142
165
|
fileSuffixes: string[];
|
|
143
|
-
precedence: number;
|
|
144
166
|
};
|
|
145
167
|
example: {
|
|
146
168
|
fileSuffixes: string[];
|
|
147
|
-
precedence: number;
|
|
148
169
|
};
|
|
149
170
|
defaults: {
|
|
150
171
|
fileSuffixes: string[];
|
|
151
|
-
precedence: number;
|
|
152
172
|
};
|
|
153
173
|
values: {
|
|
154
174
|
fileSuffixes: Array<string>;
|
|
155
|
-
precedence: number;
|
|
156
175
|
};
|
|
157
176
|
overrides: {
|
|
158
177
|
fileSuffixes: string[];
|
|
159
|
-
precedence: number;
|
|
160
178
|
};
|
|
179
|
+
container: {};
|
|
161
180
|
}>;
|
|
181
|
+
/** reference back to the graph */
|
|
162
182
|
graph?: EnvGraph;
|
|
183
|
+
/** parent data source - everything except the root will have a parent */
|
|
184
|
+
parent?: EnvGraphDataSource;
|
|
185
|
+
/** child data sources */
|
|
186
|
+
children: Array<EnvGraphDataSource>;
|
|
187
|
+
/**
|
|
188
|
+
* tracks if this data source was imported, and additional settings about the import (restricting keys)
|
|
189
|
+
* */
|
|
190
|
+
importMeta?: {
|
|
191
|
+
isImport?: boolean;
|
|
192
|
+
importKeys?: Array<string>;
|
|
193
|
+
};
|
|
194
|
+
get isImport(): boolean;
|
|
195
|
+
get importKeys(): Array<string> | undefined;
|
|
196
|
+
/** adds a child data source and sets up the correct references in both directions */
|
|
197
|
+
addChild(child: EnvGraphDataSource, importMeta?: EnvGraphDataSource['importMeta']): Promise<void>;
|
|
198
|
+
/** environment flag key (as set by @envFlag decorator) - only if set within this source */
|
|
199
|
+
_envFlagKey?: string;
|
|
200
|
+
/** environment flag key getter that will follow up the parent chain */
|
|
201
|
+
get envFlagKey(): string | undefined;
|
|
202
|
+
/** environment flag config item getter (follows up the parent chain) */
|
|
203
|
+
get envFlagConfigItem(): ConfigItem | undefined;
|
|
204
|
+
/** environment flag value getter (follows up the parent chain), and checks the graph-level fallback */
|
|
205
|
+
get envFlagValue(): ResolvedValue;
|
|
206
|
+
/** helper to resolve the envFlag value */
|
|
207
|
+
resolveCurrentEnv(): Promise<ResolvedValue>;
|
|
208
|
+
/** finish init process for this data source */
|
|
209
|
+
finishInit(): Promise<void>;
|
|
210
|
+
/**
|
|
211
|
+
* called by the finishInit - meant to be overridden by subclasses
|
|
212
|
+
* to add specific behaviour for that data source type
|
|
213
|
+
* @internal
|
|
214
|
+
* */
|
|
215
|
+
_finishInit(): Promise<void>;
|
|
163
216
|
abstract typeLabel: string;
|
|
217
|
+
abstract get label(): string;
|
|
164
218
|
type: DataSourceType;
|
|
165
219
|
applyForEnv?: string;
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
abstract get label(): string;
|
|
220
|
+
_disabled?: boolean;
|
|
221
|
+
get disabled(): boolean | undefined;
|
|
169
222
|
/** an error encountered while loading/parsing the data source */
|
|
170
|
-
|
|
223
|
+
_loadingError?: Error;
|
|
224
|
+
get loadingError(): Error | undefined;
|
|
171
225
|
get isValid(): boolean;
|
|
172
226
|
configItemDefs: Record<string, ConfigItemDef>;
|
|
173
|
-
decorators:
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
declare class ProcessEnvDataSource extends EnvGraphDataSource {
|
|
177
|
-
type: "overrides";
|
|
178
|
-
typeLabel: string;
|
|
179
|
-
label: string;
|
|
180
|
-
ignoreNewDefs: boolean;
|
|
181
|
-
static processEnvValues: Record<string, string | undefined> | undefined;
|
|
182
|
-
constructor();
|
|
227
|
+
decorators: Array<ParsedEnvSpecDecorator>;
|
|
228
|
+
getRootDecorators(decName: string): ParsedEnvSpecDecorator[];
|
|
229
|
+
getRootDecoratorSimpleValue(decName: string): any;
|
|
183
230
|
}
|
|
184
231
|
declare abstract class FileBasedDataSource extends EnvGraphDataSource {
|
|
185
232
|
isGitIgnored?: boolean;
|
|
@@ -195,7 +242,7 @@ declare abstract class FileBasedDataSource extends EnvGraphDataSource {
|
|
|
195
242
|
overrideContents?: string;
|
|
196
243
|
overrideGitIgnored?: boolean;
|
|
197
244
|
});
|
|
198
|
-
|
|
245
|
+
_finishInit(): Promise<void>;
|
|
199
246
|
abstract _parseContents(): Promise<void>;
|
|
200
247
|
}
|
|
201
248
|
declare class DotEnvFileDataSource extends FileBasedDataSource {
|
|
@@ -206,33 +253,6 @@ declare class DotEnvFileDataSource extends FileBasedDataSource {
|
|
|
206
253
|
_parseContents(): Promise<void>;
|
|
207
254
|
}
|
|
208
255
|
|
|
209
|
-
type ResolvedValue = undefined | string | number | boolean | RegExp;
|
|
210
|
-
type ResolverFunctionArgs = Array<Resolver | Record<string, Resolver>>;
|
|
211
|
-
declare abstract class Resolver {
|
|
212
|
-
readonly fnArgs: ResolverFunctionArgs;
|
|
213
|
-
static fnName?: string;
|
|
214
|
-
constructor(fnArgs: ResolverFunctionArgs);
|
|
215
|
-
abstract label: string;
|
|
216
|
-
abstract icon: string;
|
|
217
|
-
inferredType?: string;
|
|
218
|
-
_schemaErrors: Array<SchemaError>;
|
|
219
|
-
private _depsObj;
|
|
220
|
-
get childResolvers(): Array<Resolver>;
|
|
221
|
-
get schemaErrors(): Array<SchemaError>;
|
|
222
|
-
get depsObj(): Record<string, boolean>;
|
|
223
|
-
get deps(): string[];
|
|
224
|
-
protected abstract _process(ctx?: any): Promise<void | (() => void)>;
|
|
225
|
-
private configItem?;
|
|
226
|
-
process(configItem: ConfigItem): Promise<void>;
|
|
227
|
-
protected addDep(key: string): void;
|
|
228
|
-
protected abstract _resolve(): Promise<ResolvedValue>;
|
|
229
|
-
resolve(): Promise<ResolvedValue>;
|
|
230
|
-
protected getDepValue(key: string): ResolvedValue;
|
|
231
|
-
}
|
|
232
|
-
type ResolverChildClass<ChildClass extends Resolver = Resolver> = ({
|
|
233
|
-
new (...args: Array<any>): ChildClass;
|
|
234
|
-
} & typeof Resolver);
|
|
235
|
-
|
|
236
256
|
type ConfigItemDef = {
|
|
237
257
|
description?: string;
|
|
238
258
|
resolver?: Resolver;
|
|
@@ -247,8 +267,10 @@ declare class ConfigItem {
|
|
|
247
267
|
constructor(_envGraph: EnvGraph, _key: string);
|
|
248
268
|
get envGraph(): EnvGraph;
|
|
249
269
|
get key(): string;
|
|
250
|
-
|
|
251
|
-
|
|
270
|
+
/**
|
|
271
|
+
* fetch ordered list of definitions for this item, by following up sorted data sources list
|
|
272
|
+
*/
|
|
273
|
+
get defs(): ConfigItemDefAndSource[];
|
|
252
274
|
get description(): string | undefined;
|
|
253
275
|
get icon(): string | undefined;
|
|
254
276
|
get docsLinks(): {
|
|
@@ -263,7 +285,20 @@ declare class ConfigItem {
|
|
|
263
285
|
schemaErrors: Array<SchemaError>;
|
|
264
286
|
get resolverSchemaErrors(): SchemaError[];
|
|
265
287
|
process(): Promise<void>;
|
|
266
|
-
|
|
288
|
+
/**
|
|
289
|
+
* special early resolution helper
|
|
290
|
+
* currently used to resolve the envFlag before everything else has been loaded
|
|
291
|
+
* */
|
|
292
|
+
earlyResolve(): Promise<void>;
|
|
293
|
+
_isRequired: boolean;
|
|
294
|
+
/**
|
|
295
|
+
* need to track if required-ness is dynamic, e.g. based on current env
|
|
296
|
+
* because that will affect type generation (only _always_ required items are never undefined)
|
|
297
|
+
* */
|
|
298
|
+
_isRequiredDynamic: boolean;
|
|
299
|
+
private processRequired;
|
|
300
|
+
get isRequired(): boolean;
|
|
301
|
+
get isRequiredDynamic(): boolean;
|
|
267
302
|
get isSensitive(): any;
|
|
268
303
|
get errors(): (SchemaError | ValidationError | CoercionError | ResolutionError)[];
|
|
269
304
|
get validationState(): 'warn' | 'error' | 'valid';
|
|
@@ -277,7 +312,7 @@ declare class ConfigItem {
|
|
|
277
312
|
coercionError?: CoercionError;
|
|
278
313
|
validationErrors?: Array<ValidationError>;
|
|
279
314
|
get isCoerced(): boolean;
|
|
280
|
-
resolve(): Promise<void>;
|
|
315
|
+
resolve(reset?: boolean): Promise<void>;
|
|
281
316
|
get isValid(): boolean;
|
|
282
317
|
}
|
|
283
318
|
|
|
@@ -303,22 +338,25 @@ type SerializedEnvGraph = {
|
|
|
303
338
|
/** container of the overall graph and current resolution attempt / values */
|
|
304
339
|
declare class EnvGraph {
|
|
305
340
|
basePath?: string;
|
|
306
|
-
/**
|
|
307
|
-
|
|
308
|
-
|
|
341
|
+
/** root data source (.env.schema) */
|
|
342
|
+
rootDataSource?: EnvGraphDataSource;
|
|
343
|
+
/** place to store process.env overrides */
|
|
344
|
+
overrideValues: Record<string, string | undefined>;
|
|
309
345
|
/** config item key of env flag (toggles env-specific data sources enabled) */
|
|
310
346
|
envFlagKey?: string;
|
|
311
|
-
/**
|
|
312
|
-
|
|
347
|
+
/** graph-level fallback value for environment flag */
|
|
348
|
+
envFlagFallback?: string;
|
|
313
349
|
configSchema: Record<string, ConfigItem>;
|
|
314
|
-
|
|
315
|
-
|
|
350
|
+
/** virtual imports for testing */
|
|
351
|
+
virtualImports?: Record<string, string>;
|
|
352
|
+
setVirtualImports(basePath: string, files: Record<string, string>): void;
|
|
316
353
|
get sortedDataSources(): EnvGraphDataSource[];
|
|
317
354
|
registeredResolverFunctions: Record<string, ResolverChildClass>;
|
|
318
355
|
registerResolver(resolverClass: ResolverChildClass): void;
|
|
319
356
|
dataTypesRegistry: Record<string, EnvGraphDataTypeFactory>;
|
|
320
357
|
registerDataType(factory: EnvGraphDataTypeFactory): void;
|
|
321
358
|
constructor();
|
|
359
|
+
setRootDataSource(source: EnvGraphDataSource): Promise<void>;
|
|
322
360
|
finishLoad(): Promise<void>;
|
|
323
361
|
get graphAdjacencyList(): GraphAdjacencyList;
|
|
324
362
|
resolveEnvValues(): Promise<void>;
|
|
@@ -327,6 +365,7 @@ declare class EnvGraph {
|
|
|
327
365
|
get isInvalid(): boolean;
|
|
328
366
|
generateTypes(lang: string, outputPath: string): Promise<void>;
|
|
329
367
|
getRootDecoratorValue(decoratorName: string): any;
|
|
368
|
+
getRootDecorators(decoratorName: string): [EnvGraphDataSource, ParsedEnvSpecDecorator[]][];
|
|
330
369
|
}
|
|
331
370
|
|
|
332
371
|
declare function resetRedactionMap(graph: SerializedEnvGraph): void;
|
|
@@ -353,4 +392,4 @@ interface TypedEnvSchema {
|
|
|
353
392
|
}
|
|
354
393
|
declare const ENV: TypedEnvSchema;
|
|
355
394
|
|
|
356
|
-
export { ConfigLoadError as C, DotEnvFileDataSource as D, EnvGraph as E,
|
|
395
|
+
export { ConfigLoadError as C, DotEnvFileDataSource as D, EnvGraph as E, ResolutionError as R, SchemaError as S, type TypedEnvSchema as T, ValidationError as V, CoercionError as a, type SerializedEnvGraph as b, ENV as c, redactSensitiveConfig as d, revealSensitiveConfig as e, initVarlockEnv as i, resetRedactionMap as r, scanForLeaks as s, varlockSettings as v };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as EnvGraph, D as DotEnvFileDataSource,
|
|
2
|
-
export { c as ENV, b as SerializedEnvGraph } from './env-
|
|
1
|
+
import { E as EnvGraph, D as DotEnvFileDataSource, C as ConfigLoadError, S as SchemaError, V as ValidationError, a as CoercionError, R as ResolutionError, i as initVarlockEnv } from './env-B_LAqK4w.js';
|
|
2
|
+
export { c as ENV, b as SerializedEnvGraph } from './env-B_LAqK4w.js';
|
|
3
3
|
export { patchGlobalConsole } from './runtime/patch-console.js';
|
|
4
4
|
export { patchGlobalServerResponse } from './runtime/patch-server-response.js';
|
|
5
5
|
export { patchGlobalResponse } from './runtime/patch-response.js';
|
|
@@ -31,7 +31,6 @@ declare function getBuildTimeReplacements(opts?: {
|
|
|
31
31
|
declare const internal: {
|
|
32
32
|
EnvGraph: typeof EnvGraph;
|
|
33
33
|
DotEnvFileDataSource: typeof DotEnvFileDataSource;
|
|
34
|
-
ProcessEnvDataSource: typeof ProcessEnvDataSource;
|
|
35
34
|
loadEnvGraph: typeof loadEnvGraph;
|
|
36
35
|
ConfigLoadError: typeof ConfigLoadError;
|
|
37
36
|
SchemaError: typeof SchemaError;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { checkForConfigErrors } from './chunk-
|
|
2
|
-
import {
|
|
3
|
-
import { ResolutionError, CoercionError, ValidationError, SchemaError, ConfigLoadError, loadEnvGraph, ProcessEnvDataSource, DotEnvFileDataSource, EnvGraph } from './chunk-ZW2T4C6A.js';
|
|
1
|
+
import { loadVarlockEnvGraph, checkForConfigErrors } from './chunk-T3I4UFB2.js';
|
|
2
|
+
import { ResolutionError, CoercionError, ValidationError, SchemaError, ConfigLoadError, loadEnvGraph, DotEnvFileDataSource, EnvGraph } from './chunk-MV5ZAKN7.js';
|
|
4
3
|
export { patchGlobalConsole } from './chunk-UPKIHHPE.js';
|
|
5
4
|
export { patchGlobalResponse } from './chunk-OM3JCP4E.js';
|
|
6
5
|
export { patchGlobalServerResponse } from './chunk-POJECYSY.js';
|
|
@@ -35,7 +34,6 @@ var internal = {
|
|
|
35
34
|
// Core classes
|
|
36
35
|
EnvGraph,
|
|
37
36
|
DotEnvFileDataSource,
|
|
38
|
-
ProcessEnvDataSource,
|
|
39
37
|
// Loader function
|
|
40
38
|
loadEnvGraph,
|
|
41
39
|
// Error classes
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;AAiBA,eAAsB,IAAA,GAAO;AAE3B,EAAA,MAAM,QAAA,GAAW,MAAM,mBAAA,EAAoB;AAC3C,EAAA,MAAM,SAAS,gBAAA,EAAiB;AAChC,EAAA,oBAAA,CAAqB,QAAQ,CAAA;AAG7B,EAAA,OAAA,CAAQ,IAAI,aAAA,GAAgB,IAAA,CAAK,SAAA,CAAU,QAAA,CAAS,oBAAoB,CAAA;AACxE,EAAA,cAAA,EAAe;AAEjB;AAVsB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA;AAaf,SAAS,yBAAyB,IAAA,EAGtC;AACD,EAAA,IAAI,CAAC,OAAA,CAAQ,GAAA,CAAI,aAAA,SAAsB,EAAC;AACxC,EAAA,MAAM,OAAA,GAAU,IAAA,CAAK,KAAA,CAAM,OAAA,CAAQ,IAAI,aAAa,CAAA;AACpD,EAAA,MAAM,eAAe,EAAC;AACtB,EAAA,KAAA,MAAW,GAAA,IAAO,QAAQ,MAAA,EAAQ;AAChC,IAAA,MAAM,QAAA,GAAW,OAAA,CAAQ,MAAA,CAAO,GAAG,CAAA;AACnC,IAAA,MAAM,WAAA,GAAc,CAAC,QAAA,CAAS,WAAA,IAAe,IAAA,EAAM,gBAAA;AACnD,IAAA,IAAI,CAAC,WAAA,EAAa;AAClB,IAAA,YAAA,CAAa,CAAA,EAAG,IAAA,EAAM,SAAA,IAAa,KAAK,IAAI,GAAG,CAAA,CAAE,CAAA,GAAI,IAAA,CAAK,SAAA,CAAU,OAAA,CAAQ,MAAA,CAAO,GAAG,EAAE,KAAK,CAAA;AAAA,EAC/F;AACA,EAAA,OAAO,YAAA;AACT;AAdgB,MAAA,CAAA,wBAAA,EAAA,0BAAA,CAAA;AAiBT,IAAM,QAAA,GAAW;AAAA;AAAA,EAEtB,QAAA;AAAA,EACA,oBAAA;AAAA;AAAA,EAGA,YAAA;AAAA;AAAA,EAGA,eAAA;AAAA,EACA,WAAA;AAAA,EACA,eAAA;AAAA,EACA,aAAA;AAAA,EACA,eAAA;AAAA;AAAA,EAGA,mBAAA;AAAA,EACA,oBAAA;AAAA,EACA;AACF","file":"index.js","sourcesContent":["import { checkForConfigErrors } from './cli/helpers/error-checks';\nimport { loadVarlockEnvGraph } from './lib/load-graph';\nimport { initVarlockEnv } from './runtime/env';\n\n// Import env-graph components for internal API\nimport {\n EnvGraph,\n loadEnvGraph,\n DotEnvFileDataSource,\n ConfigLoadError,\n SchemaError,\n ValidationError,\n CoercionError,\n ResolutionError,\n type SerializedEnvGraph,\n} from '../env-graph';\n\nexport async function load() {\n // TODO: add some options\n const envGraph = await loadVarlockEnvGraph();\n await envGraph.resolveEnvValues();\n checkForConfigErrors(envGraph);\n\n // loadFromSerializedGraph(envGraph.getSerializedGraph());\n process.env.__VARLOCK_ENV = JSON.stringify(envGraph.getSerializedGraph());\n initVarlockEnv();\n // TODO: return resolved env and schema / meta info\n}\n\n\nexport function getBuildTimeReplacements(opts?: {\n objectKey?: string,\n includeSensitive?: boolean,\n}) {\n if (!process.env.__VARLOCK_ENV) return {};\n const envInfo = JSON.parse(process.env.__VARLOCK_ENV) as SerializedEnvGraph;\n const replacements = {} as Record<string, string>;\n for (const key in envInfo.config) {\n const itemInfo = envInfo.config[key];\n const replaceItem = !itemInfo.isSensitive || opts?.includeSensitive;\n if (!replaceItem) continue;\n replacements[`${opts?.objectKey || 'ENV'}.${key}`] = JSON.stringify(envInfo.config[key].value);\n }\n return replacements;\n}\n\n// Internal API for direct env graph manipulation\nexport const internal = {\n // Core classes\n EnvGraph,\n DotEnvFileDataSource,\n\n // Loader function\n loadEnvGraph,\n\n // Error classes\n ConfigLoadError,\n SchemaError,\n ValidationError,\n CoercionError,\n ResolutionError,\n\n // Varlock-specific utilities\n loadVarlockEnvGraph,\n checkForConfigErrors,\n initVarlockEnv,\n};\n\nexport { patchGlobalConsole } from './runtime/patch-console';\nexport { patchGlobalServerResponse } from './runtime/patch-server-response';\nexport { patchGlobalResponse } from './runtime/patch-response';\nexport { ENV } from './runtime/env';\nexport type { SerializedEnvGraph };\n"]}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { commandFn, commandSpec } from './chunk-LXJMZMID.js';
|
|
2
|
+
import './chunk-5EBVEGDW.js';
|
|
3
|
+
import './chunk-33ROL4J5.js';
|
|
4
|
+
import './chunk-MV5ZAKN7.js';
|
|
5
|
+
import './chunk-FGMXIEFA.js';
|
|
6
|
+
import './chunk-XN24GZXQ.js';
|
|
7
|
+
//# sourceMappingURL=init.command-CTO64XBL.js.map
|
|
8
|
+
//# sourceMappingURL=init.command-CTO64XBL.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"init.command-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"init.command-CTO64XBL.js"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { commandFn, commandSpec } from './chunk-AS4LIW7A.js';
|
|
2
|
+
import './chunk-33ROL4J5.js';
|
|
3
|
+
import './chunk-T3I4UFB2.js';
|
|
4
|
+
import './chunk-MV5ZAKN7.js';
|
|
5
|
+
import './chunk-FGMXIEFA.js';
|
|
6
|
+
import './chunk-XN24GZXQ.js';
|
|
7
|
+
//# sourceMappingURL=load.command-EWIJDF55.js.map
|
|
8
|
+
//# sourceMappingURL=load.command-EWIJDF55.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"load.command-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"load.command-EWIJDF55.js"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { commandFn, commandSpec } from './chunk-UA3DMAAQ.js';
|
|
2
|
+
import './chunk-5EBVEGDW.js';
|
|
3
|
+
import './chunk-33ROL4J5.js';
|
|
4
|
+
import './chunk-MV5ZAKN7.js';
|
|
5
|
+
import './chunk-FGMXIEFA.js';
|
|
6
|
+
import './chunk-XN24GZXQ.js';
|
|
7
|
+
//# sourceMappingURL=login.command-UZJJ4XTV.js.map
|
|
8
|
+
//# sourceMappingURL=login.command-UZJJ4XTV.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"login.command-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"login.command-UZJJ4XTV.js"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { commandFn, commandSpec } from './chunk-IML4QZHB.js';
|
|
2
|
+
import './chunk-33ROL4J5.js';
|
|
3
|
+
import './chunk-T3I4UFB2.js';
|
|
4
|
+
import './chunk-MV5ZAKN7.js';
|
|
5
|
+
import './chunk-FGMXIEFA.js';
|
|
6
|
+
import './chunk-XN24GZXQ.js';
|
|
7
|
+
//# sourceMappingURL=run.command-T44BAZ7X.js.map
|
|
8
|
+
//# sourceMappingURL=run.command-T44BAZ7X.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"run.command-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"run.command-T44BAZ7X.js"}
|
package/dist/runtime/env.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { c as ENV, T as TypedEnvSchema, i as initVarlockEnv, d as redactSensitiveConfig, r as resetRedactionMap, e as revealSensitiveConfig, s as scanForLeaks, v as varlockSettings } from '../env-
|
|
1
|
+
export { c as ENV, T as TypedEnvSchema, i as initVarlockEnv, d as redactSensitiveConfig, r as resetRedactionMap, e as revealSensitiveConfig, s as scanForLeaks, v as varlockSettings } from '../env-B_LAqK4w.js';
|
|
2
2
|
import '@env-spec/parser';
|
|
3
3
|
import '@env-spec/utils/type-utils';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { commandFn, commandSpec } from './chunk-MVYXWTAV.js';
|
|
2
|
+
import './chunk-5EBVEGDW.js';
|
|
3
|
+
import './chunk-33ROL4J5.js';
|
|
4
|
+
import './chunk-MV5ZAKN7.js';
|
|
5
|
+
import './chunk-FGMXIEFA.js';
|
|
6
|
+
import './chunk-XN24GZXQ.js';
|
|
7
|
+
//# sourceMappingURL=telemetry.command-2C3MQA4K.js.map
|
|
8
|
+
//# sourceMappingURL=telemetry.command-2C3MQA4K.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"telemetry.command-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"telemetry.command-2C3MQA4K.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "varlock",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.13",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -68,14 +68,14 @@
|
|
|
68
68
|
"debug": "^4.4.1",
|
|
69
69
|
"execa": "^9.6.0",
|
|
70
70
|
"which": "^5.0.0",
|
|
71
|
-
"@env-spec/parser": "^0.0.
|
|
71
|
+
"@env-spec/parser": "^0.0.5"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
74
|
"@clack/core": "^0.5.0",
|
|
75
75
|
"@clack/prompts": "^0.11.0",
|
|
76
76
|
"@sindresorhus/is": "^7.0.2",
|
|
77
77
|
"@types/debug": "^4.1.12",
|
|
78
|
-
"@types/node": "^24.
|
|
78
|
+
"@types/node": "^24.3.0",
|
|
79
79
|
"@types/which": "^3.0.4",
|
|
80
80
|
"@yao-pkg/pkg": "^6.6.0",
|
|
81
81
|
"ansis": "^4.1.0",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/commands/load.command.ts"],"names":[],"mappings":"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","file":"chunk-4CE75BSX.js","sourcesContent":["import { define } from 'gunshi';\nimport _ from '@env-spec/utils/my-dash';\n\nimport { loadVarlockEnvGraph } from '../../lib/load-graph';\nimport { getItemSummary } from '../../lib/formatting';\nimport { checkForConfigErrors, checkForSchemaErrors } from '../helpers/error-checks';\nimport { type TypedGunshiCommandFn } from '../helpers/gunshi-type-utils';\n\nexport const commandSpec = define({\n name: 'load',\n description: 'Load env according to schema and resolve values',\n args: {\n format: {\n type: 'enum',\n short: 'f',\n choices: ['pretty', 'json', 'env', 'json-full'],\n description: 'Format of output',\n default: 'pretty',\n },\n 'show-all': {\n type: 'boolean',\n description: 'When load is failing, show all items rather than only failing items',\n },\n env: {\n type: 'string',\n description: 'Set the environment (e.g., production, development, etc) - will be overridden by @envFlag in the schema if present',\n },\n },\n});\n\n\nexport const commandFn: TypedGunshiCommandFn<typeof commandSpec> = async (ctx) => {\n const { format, 'show-all': showAll } = ctx.values;\n\n const envGraph = await loadVarlockEnvGraph({\n currentEnvFallback: ctx.values.env,\n });\n checkForSchemaErrors(envGraph);\n\n // TODO: move into a more general post-load hook system\n if (envGraph.schemaDataSource?.decorators.generateTypes) {\n // TODO: much of this logic should move to the definition of the decorator itself\n const typeGenSettings = envGraph.schemaDataSource?.decorators.generateTypes.bareFnArgs?.simplifiedValues;\n if (!_.isPlainObject(typeGenSettings)) {\n throw new Error('@generateTypes - must be a fn call with key/value args');\n }\n if (!typeGenSettings.lang) throw new Error('@generateTypes - must set `lang` arg');\n if (typeGenSettings.lang !== 'ts') throw new Error(`@generateTypes - unsupported language: ${typeGenSettings.lang}`);\n if (!typeGenSettings.path) throw new Error('@generateTypes - must set `path` arg');\n if (!_.isString(typeGenSettings.path)) throw new Error('@generateTypes - `path` arg must be a string');\n await envGraph.generateTypes(typeGenSettings.lang, typeGenSettings.path);\n }\n\n await envGraph.resolveEnvValues();\n checkForConfigErrors(envGraph, { showAll });\n\n if (format === 'pretty') {\n for (const itemKey in envGraph.configSchema) {\n const item = envGraph.configSchema[itemKey];\n console.log(getItemSummary(item));\n }\n } else if (format === 'json') {\n console.log(JSON.stringify(envGraph.getResolvedEnvObject(), null, 2));\n } else if (format === 'json-full') {\n console.log(JSON.stringify(envGraph.getSerializedGraph(), null, 2));\n } else if (format === 'env') {\n const resolvedEnv = envGraph.getResolvedEnvObject();\n for (const key in resolvedEnv) {\n const value = resolvedEnv[key];\n let strValue: string;\n if (value === undefined) {\n strValue = '';\n } else if (typeof value === 'string') {\n strValue = `\"${value.replaceAll('\"', '\\\\\"').replaceAll('\\n', '\\\\n')}\"`;\n } else {\n strValue = JSON.stringify(value);\n }\n console.log(`${key}=${strValue}`);\n }\n } else {\n throw new Error(`Unknown format: ${format}`);\n }\n\n // const resolvedEnv = envGraph.getResolvedEnvObject();\n // console.log(resolvedEnv);\n};\n"]}
|