varlock 0.7.1 → 0.7.3
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/auto-load.js +2 -2
- package/dist/chunk-4JWJZ4P3.js +86 -0
- package/dist/chunk-4JWJZ4P3.js.map +1 -0
- package/dist/{chunk-B6SVDIAN.js → chunk-5LNYCOEO.js} +1490 -207
- package/dist/chunk-5LNYCOEO.js.map +1 -0
- package/dist/{chunk-MC4SUVBY.js → chunk-ANZNVJLY.js} +18 -8
- package/dist/chunk-ANZNVJLY.js.map +1 -0
- package/dist/chunk-CHQDS2PI.js +138 -0
- package/dist/chunk-CHQDS2PI.js.map +1 -0
- package/dist/{chunk-TQDVHRUW.js → chunk-CNDSEDGU.js} +14 -137
- package/dist/chunk-CNDSEDGU.js.map +1 -0
- package/dist/{chunk-JTK7LTYE.js → chunk-CS57IAAJ.js} +8 -17
- package/dist/chunk-CS57IAAJ.js.map +1 -0
- package/dist/chunk-EC3NKELX.js +79 -0
- package/dist/chunk-EC3NKELX.js.map +1 -0
- package/dist/{chunk-UGUCGDKH.js → chunk-FVFI4EQN.js} +6 -5
- package/dist/chunk-FVFI4EQN.js.map +1 -0
- package/dist/chunk-GXNQVEXD.js +15 -0
- package/dist/chunk-GXNQVEXD.js.map +1 -0
- package/dist/{chunk-BEV4WCAI.js → chunk-GYK3QFZB.js} +8 -4
- package/dist/chunk-GYK3QFZB.js.map +1 -0
- package/dist/{chunk-WKQ6WUA7.js → chunk-HMMDVPDG.js} +6 -5
- package/dist/chunk-HMMDVPDG.js.map +1 -0
- package/dist/chunk-J4PGGBUP.js +162 -0
- package/dist/chunk-J4PGGBUP.js.map +1 -0
- package/dist/chunk-N5O4Z32O.js +74 -0
- package/dist/chunk-N5O4Z32O.js.map +1 -0
- package/dist/{chunk-CHWXFSUK.js → chunk-NTGBMXQQ.js} +5 -5
- package/dist/{chunk-CHWXFSUK.js.map → chunk-NTGBMXQQ.js.map} +1 -1
- package/dist/{chunk-4KSIULUK.js → chunk-QLNQ3KVC.js} +5 -4
- package/dist/chunk-QLNQ3KVC.js.map +1 -0
- package/dist/{chunk-WHSHSZQR.js → chunk-R54KUFZA.js} +4 -4
- package/dist/{chunk-WHSHSZQR.js.map → chunk-R54KUFZA.js.map} +1 -1
- package/dist/{chunk-4MCJ5H6K.js → chunk-RYMTOGGL.js} +3 -3
- package/dist/{chunk-4MCJ5H6K.js.map → chunk-RYMTOGGL.js.map} +1 -1
- package/dist/chunk-W4CM34OJ.js +387 -0
- package/dist/chunk-W4CM34OJ.js.map +1 -0
- package/dist/{chunk-EQGPMXDI.js → chunk-ZB2JSJLY.js} +6 -5
- package/dist/chunk-ZB2JSJLY.js.map +1 -0
- package/dist/cli/cli-executable.js +177 -26
- package/dist/cli/cli-executable.js.map +1 -1
- package/dist/config-item-IYYV4PO6.js +5 -0
- package/dist/{config-item-VMLNH4QK.js.map → config-item-IYYV4PO6.js.map} +1 -1
- package/dist/dotenv-compat.js +2 -2
- package/dist/{env-graph-BI5ASRYd.d.ts → env-graph-BxA2OztA.d.ts} +60 -1
- package/dist/explain.command-VFR5SUW3.js +12 -0
- package/dist/explain.command-VFR5SUW3.js.map +1 -0
- package/dist/index.d.ts +4 -2
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/init.command-HRY74HHU.js +12 -0
- package/dist/{init.command-C2WNQ4UP.js.map → init.command-HRY74HHU.js.map} +1 -1
- package/dist/install-plugin.command-WDCWQWT7.js +11 -0
- package/dist/install-plugin.command-WDCWQWT7.js.map +1 -0
- package/dist/lib/exec-sync-varlock.d.ts +7 -0
- package/dist/lib/exec-sync-varlock.js +1 -1
- package/dist/load.command-FNMIEIJB.js +12 -0
- package/dist/{load.command-5X3BSCLF.js.map → load.command-FNMIEIJB.js.map} +1 -1
- package/dist/plugin-lib.d.ts +2 -2
- package/dist/printenv.command-3HLXLNHS.js +12 -0
- package/dist/{printenv.command-XZEQ3CZB.js.map → printenv.command-3HLXLNHS.js.map} +1 -1
- package/dist/run.command-SXM3J6GI.js +13 -0
- package/dist/{run.command-FE26WTNO.js.map → run.command-SXM3J6GI.js.map} +1 -1
- package/dist/runtime/env.d.ts +1 -1
- package/dist/scan.command-PW7HYURX.js +14 -0
- package/dist/{scan.command-2M4RN4ZP.js.map → scan.command-PW7HYURX.js.map} +1 -1
- package/dist/telemetry.command-4HKKZK7N.js +11 -0
- package/dist/{telemetry.command-SPOD3GAJ.js.map → telemetry.command-4HKKZK7N.js.map} +1 -1
- package/dist/typegen.command-O6OXWCVX.js +12 -0
- package/dist/{typegen.command-RUNVYBAM.js.map → typegen.command-O6OXWCVX.js.map} +1 -1
- package/package.json +2 -2
- package/dist/chunk-4KSIULUK.js.map +0 -1
- package/dist/chunk-B6SVDIAN.js.map +0 -1
- package/dist/chunk-BEV4WCAI.js.map +0 -1
- package/dist/chunk-EQGPMXDI.js.map +0 -1
- package/dist/chunk-GCEP6UVQ.js +0 -60
- package/dist/chunk-GCEP6UVQ.js.map +0 -1
- package/dist/chunk-JMJCAFEL.js +0 -1434
- package/dist/chunk-JMJCAFEL.js.map +0 -1
- package/dist/chunk-JTK7LTYE.js.map +0 -1
- package/dist/chunk-K6M42GW2.js +0 -59
- package/dist/chunk-K6M42GW2.js.map +0 -1
- package/dist/chunk-MC4SUVBY.js.map +0 -1
- package/dist/chunk-TQDVHRUW.js.map +0 -1
- package/dist/chunk-UGUCGDKH.js.map +0 -1
- package/dist/chunk-WKQ6WUA7.js.map +0 -1
- package/dist/config-item-VMLNH4QK.js +0 -5
- package/dist/init.command-C2WNQ4UP.js +0 -11
- package/dist/load.command-5X3BSCLF.js +0 -11
- package/dist/printenv.command-XZEQ3CZB.js +0 -11
- package/dist/run.command-FE26WTNO.js +0 -12
- package/dist/scan.command-2M4RN4ZP.js +0 -12
- package/dist/telemetry.command-SPOD3GAJ.js +0 -10
- package/dist/typegen.command-RUNVYBAM.js +0 -11
|
@@ -268,6 +268,7 @@ declare const DATA_SOURCE_TYPES: Readonly<{
|
|
|
268
268
|
fileSuffixes: string[];
|
|
269
269
|
};
|
|
270
270
|
container: {};
|
|
271
|
+
'import-alias': {};
|
|
271
272
|
}>;
|
|
272
273
|
type DataSourceType = keyof typeof DATA_SOURCE_TYPES;
|
|
273
274
|
declare abstract class EnvGraphDataSource {
|
|
@@ -288,6 +289,7 @@ declare abstract class EnvGraphDataSource {
|
|
|
288
289
|
fileSuffixes: string[];
|
|
289
290
|
};
|
|
290
291
|
container: {};
|
|
292
|
+
'import-alias': {};
|
|
291
293
|
}>;
|
|
292
294
|
/** reference back to the graph */
|
|
293
295
|
graph?: EnvGraph;
|
|
@@ -311,6 +313,14 @@ declare abstract class EnvGraphDataSource {
|
|
|
311
313
|
protected _initChild(child: EnvGraphDataSource, importMeta?: EnvGraphDataSource['importMeta']): Promise<void>;
|
|
312
314
|
/** adds a child data source, running both finishInit and import processing */
|
|
313
315
|
addChild(child: EnvGraphDataSource, importMeta?: EnvGraphDataSource['importMeta']): Promise<void>;
|
|
316
|
+
/**
|
|
317
|
+
* When true, direct children of this data source are treated as top-level entry points:
|
|
318
|
+
* they inherit the "no parent" semantics and are never classified as env-specific
|
|
319
|
+
* solely because of their filename (e.g. `.env.production` used as an explicit entry
|
|
320
|
+
* point would not be env-specific, but one auto-loaded inside a directory would be).
|
|
321
|
+
* Only `MultiplePathsContainerDataSource` sets this to true.
|
|
322
|
+
*/
|
|
323
|
+
childrenAreRoots?: boolean;
|
|
314
324
|
/**
|
|
315
325
|
* Whether this data source is environment-specific.
|
|
316
326
|
* A source is env-specific if:
|
|
@@ -323,6 +333,9 @@ declare abstract class EnvGraphDataSource {
|
|
|
323
333
|
* Note: `applyForEnv` from filename parsing is only relevant for auto-loaded files.
|
|
324
334
|
* Explicitly imported files (via `@import`) are controlled by the import mechanism,
|
|
325
335
|
* not the auto-load-by-env logic, so their `applyForEnv` is ignored here.
|
|
336
|
+
* Similarly, a file that is the explicit root entry point (no parent, or whose parent
|
|
337
|
+
* has `childrenAreRoots` set) is never treated as env-specific even if its filename
|
|
338
|
+
* contains an env qualifier.
|
|
326
339
|
*/
|
|
327
340
|
get isEnvSpecific(): boolean;
|
|
328
341
|
/** true when the source has a `@disable` decorator whose value is not static */
|
|
@@ -422,7 +435,7 @@ declare class ConfigItem {
|
|
|
422
435
|
_internalDefs: Array<ConfigItemDefAndSource>;
|
|
423
436
|
constructor(envGraph: EnvGraph, key: string);
|
|
424
437
|
/**
|
|
425
|
-
* fetch ordered list of definitions for this item, by following
|
|
438
|
+
* fetch ordered list of definitions for this item, by following the sorted definition sources list
|
|
426
439
|
* internal defs (builtins) are appended last (lowest priority)
|
|
427
440
|
*/
|
|
428
441
|
get defs(): ConfigItemDefAndSource[];
|
|
@@ -438,6 +451,14 @@ declare class ConfigItem {
|
|
|
438
451
|
url: string;
|
|
439
452
|
description?: string;
|
|
440
453
|
}[];
|
|
454
|
+
/** Whether the resolved value came from a process.env override rather than file definitions */
|
|
455
|
+
get isOverridden(): boolean;
|
|
456
|
+
/**
|
|
457
|
+
* Returns the definition+source that would provide the value resolver
|
|
458
|
+
* (i.e. the "winning" definition), or undefined if no definition has a resolver.
|
|
459
|
+
* This is useful for explaining where a value comes from regardless of overrides.
|
|
460
|
+
*/
|
|
461
|
+
get activeValueDef(): ConfigItemDefAndSource | undefined;
|
|
441
462
|
get valueResolver(): Resolver | undefined;
|
|
442
463
|
allDecorators: Array<ItemDecoratorInstance>;
|
|
443
464
|
effectiveDecorators: Record<string, ItemDecoratorInstance>;
|
|
@@ -624,9 +645,17 @@ type SerializedEnvGraphErrors = {
|
|
|
624
645
|
/** Root-level errors not tied to a specific config item (loading errors, schema errors, plugin errors, etc.) */
|
|
625
646
|
root?: Array<string>;
|
|
626
647
|
};
|
|
648
|
+
/** Entry in the sorted definition sources list — pairs a data source with the importKeys
|
|
649
|
+
* filter that applies at that specific position in the precedence chain */
|
|
650
|
+
type DefinitionSourceEntry = {
|
|
651
|
+
source: EnvGraphDataSource;
|
|
652
|
+
/** importKeys filter for this position (undefined = all keys visible) */
|
|
653
|
+
importKeys?: Array<string>;
|
|
654
|
+
};
|
|
627
655
|
type SerializedEnvGraph = {
|
|
628
656
|
basePath?: string;
|
|
629
657
|
sources: Array<{
|
|
658
|
+
type: string;
|
|
630
659
|
label: string;
|
|
631
660
|
enabled: boolean;
|
|
632
661
|
path?: string;
|
|
@@ -654,10 +683,40 @@ declare class EnvGraph {
|
|
|
654
683
|
/** graph-level fallback value for environment flag */
|
|
655
684
|
envFlagFallback?: string;
|
|
656
685
|
configSchema: Record<string, ConfigItem>;
|
|
686
|
+
/**
|
|
687
|
+
* Tracks directory/file paths that have already been loaded as imports.
|
|
688
|
+
* Maps each import path to the data source that was created for it.
|
|
689
|
+
* Used to prevent diamond-dependency re-imports (same schema imported via multiple paths),
|
|
690
|
+
* which would otherwise cause plugin init decorators to run multiple times.
|
|
691
|
+
*/
|
|
692
|
+
private _loadedImportPaths;
|
|
693
|
+
/** Returns the existing source for a path if already loaded, or undefined */
|
|
694
|
+
getLoadedImportSource(importPath: string): EnvGraphDataSource | undefined;
|
|
695
|
+
/** Records the data source that was created for an import path */
|
|
696
|
+
recordLoadedImportPath(importPath: string, dataSource: EnvGraphDataSource): void;
|
|
697
|
+
/**
|
|
698
|
+
* Register ConfigItems for keys visible through an import
|
|
699
|
+
* that may not have been registered during the original source's finishInit.
|
|
700
|
+
*/
|
|
701
|
+
registerItemsForImport(source: EnvGraphDataSource, importSite: EnvGraphDataSource, importKeys?: Array<string>): void;
|
|
702
|
+
/** Get a data source and all its descendants (DFS) */
|
|
703
|
+
private _getDescendants;
|
|
657
704
|
/** virtual imports for testing */
|
|
658
705
|
virtualImports?: Record<string, string>;
|
|
659
706
|
setVirtualImports(basePath: string, files: Record<string, string>): void;
|
|
660
707
|
get sortedDataSources(): EnvGraphDataSource[];
|
|
708
|
+
/**
|
|
709
|
+
* Precedence-ordered list of definition sources, used by ConfigItem.defs.
|
|
710
|
+
*
|
|
711
|
+
* Unlike `sortedDataSources` (which contains each real source exactly once),
|
|
712
|
+
* this list can contain the same source multiple times at different positions
|
|
713
|
+
* when it's imported from multiple locations (diamond dependency). Each entry
|
|
714
|
+
* carries its own `importKeys` filter for that specific import context.
|
|
715
|
+
*
|
|
716
|
+
* Built from `sortedDataSources` by expanding `ImportAliasSource` nodes into
|
|
717
|
+
* the original source's full subtree at the alias's precedence position.
|
|
718
|
+
*/
|
|
719
|
+
get sortedDefinitionSources(): Array<DefinitionSourceEntry>;
|
|
661
720
|
registeredResolverFunctions: Record<string, ResolverChildClass>;
|
|
662
721
|
registerResolver(resolverClass: ResolverChildClass): void;
|
|
663
722
|
dataTypesRegistry: Record<string, EnvGraphDataTypeFactory>;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { commandFn, commandSpec } from './chunk-J4PGGBUP.js';
|
|
2
|
+
import './chunk-4A54P4EM.js';
|
|
3
|
+
import './chunk-QLNQ3KVC.js';
|
|
4
|
+
import './chunk-4JWJZ4P3.js';
|
|
5
|
+
import './chunk-CHQDS2PI.js';
|
|
6
|
+
import './chunk-CNDSEDGU.js';
|
|
7
|
+
import './chunk-5LNYCOEO.js';
|
|
8
|
+
import './chunk-6CCHLM3U.js';
|
|
9
|
+
import './chunk-XLYSNOR3.js';
|
|
10
|
+
import './chunk-6PEHRAEP.js';
|
|
11
|
+
//# sourceMappingURL=explain.command-VFR5SUW3.js.map
|
|
12
|
+
//# sourceMappingURL=explain.command-VFR5SUW3.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"explain.command-VFR5SUW3.js"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { E as EnvGraph, e as DotEnvFileDataSource, f as ConfigLoadError, S as SchemaError, b as ValidationError, C as CoercionError, R as ResolutionError } from './env-graph-
|
|
2
|
-
export { D as Debugger, d as SerializedEnvGraph, c as createDebug } from './env-graph-
|
|
1
|
+
import { E as EnvGraph, e as DotEnvFileDataSource, f as ConfigLoadError, S as SchemaError, b as ValidationError, C as CoercionError, R as ResolutionError } from './env-graph-BxA2OztA.js';
|
|
2
|
+
export { D as Debugger, d as SerializedEnvGraph, c as createDebug } from './env-graph-BxA2OztA.js';
|
|
3
3
|
import { initVarlockEnv } from './runtime/env.js';
|
|
4
4
|
export { ENV } from './runtime/env.js';
|
|
5
5
|
export { patchGlobalConsole } from './runtime/patch-console.js';
|
|
@@ -11,6 +11,8 @@ import '@env-spec/utils/type-utils';
|
|
|
11
11
|
declare function loadEnvGraph(opts?: {
|
|
12
12
|
basePath?: string;
|
|
13
13
|
entryFilePath?: string;
|
|
14
|
+
/** Multiple entry file paths — when provided, creates a virtual root container for all paths */
|
|
15
|
+
entryFilePaths?: Array<string>;
|
|
14
16
|
relativePaths?: Array<string>;
|
|
15
17
|
checkGitIgnored?: boolean;
|
|
16
18
|
excludeDirs?: Array<string>;
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
export { patchGlobalResponse } from './chunk-LVZSZAKN.js';
|
|
2
2
|
export { patchGlobalServerResponse } from './chunk-MYHVSJ3X.js';
|
|
3
|
-
import { checkBunVersion } from './chunk-
|
|
4
|
-
import { checkForConfigErrors } from './chunk-
|
|
5
|
-
import { loadVarlockEnvGraph } from './chunk-
|
|
6
|
-
import
|
|
7
|
-
import {
|
|
3
|
+
import { checkBunVersion } from './chunk-RYMTOGGL.js';
|
|
4
|
+
import { checkForConfigErrors } from './chunk-QLNQ3KVC.js';
|
|
5
|
+
import { loadVarlockEnvGraph } from './chunk-4JWJZ4P3.js';
|
|
6
|
+
import './chunk-CHQDS2PI.js';
|
|
7
|
+
import { loadEnvGraph } from './chunk-CNDSEDGU.js';
|
|
8
|
+
import { DotEnvFileDataSource, EnvGraph } from './chunk-5LNYCOEO.js';
|
|
8
9
|
import { ResolutionError, CoercionError, ValidationError, SchemaError, ConfigLoadError } from './chunk-6CCHLM3U.js';
|
|
9
10
|
export { createDebug } from './chunk-6CCHLM3U.js';
|
|
10
11
|
export { patchGlobalConsole } from './chunk-BC7LU4LG.js';
|
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":";;;;;;;;;;;;;;;;;AAkBA,eAAsB,IAAA,GAAO;AAC3B,EAAA,eAAA,EAAgB;AAEhB,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;AAXsB,MAAA,CAAA,IAAA,EAAA,MAAA,CAAA;AAcf,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';\nimport { checkBunVersion } from './lib/check-bun-version';\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 checkBunVersion();\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 { createDebug, type Debugger } from './lib/debug';\nexport type { SerializedEnvGraph };\n"]}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { commandFn, commandSpec } from './chunk-W4CM34OJ.js';
|
|
2
|
+
import './chunk-GGBNUVWR.js';
|
|
3
|
+
import './chunk-R54KUFZA.js';
|
|
4
|
+
import './chunk-4A54P4EM.js';
|
|
5
|
+
import './chunk-CHQDS2PI.js';
|
|
6
|
+
import './chunk-CNDSEDGU.js';
|
|
7
|
+
import './chunk-5LNYCOEO.js';
|
|
8
|
+
import './chunk-6CCHLM3U.js';
|
|
9
|
+
import './chunk-XLYSNOR3.js';
|
|
10
|
+
import './chunk-6PEHRAEP.js';
|
|
11
|
+
//# sourceMappingURL=init.command-HRY74HHU.js.map
|
|
12
|
+
//# sourceMappingURL=init.command-HRY74HHU.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"init.command-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"init.command-HRY74HHU.js"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { commandFn, commandSpec } from './chunk-EC3NKELX.js';
|
|
2
|
+
import './chunk-GXNQVEXD.js';
|
|
3
|
+
import './chunk-R54KUFZA.js';
|
|
4
|
+
import './chunk-4A54P4EM.js';
|
|
5
|
+
import './chunk-CNDSEDGU.js';
|
|
6
|
+
import './chunk-5LNYCOEO.js';
|
|
7
|
+
import './chunk-6CCHLM3U.js';
|
|
8
|
+
import './chunk-XLYSNOR3.js';
|
|
9
|
+
import './chunk-6PEHRAEP.js';
|
|
10
|
+
//# sourceMappingURL=install-plugin.command-WDCWQWT7.js.map
|
|
11
|
+
//# sourceMappingURL=install-plugin.command-WDCWQWT7.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"install-plugin.command-WDCWQWT7.js"}
|
|
@@ -9,6 +9,13 @@ import { execSync } from 'child_process';
|
|
|
9
9
|
declare function execSyncVarlock(command: string, opts?: (Parameters<typeof execSync>[1] & {
|
|
10
10
|
exitOnError?: boolean;
|
|
11
11
|
showLogsOnError?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Additional directory to start searching for the varlock binary from.
|
|
14
|
+
* Searched before process.cwd(). Pass `import.meta.dirname` from the
|
|
15
|
+
* call-site so that in monorepos the binary installed next to the
|
|
16
|
+
* importing package is found even when cwd is an unrelated workspace root.
|
|
17
|
+
*/
|
|
18
|
+
callerDir?: string;
|
|
12
19
|
})): string;
|
|
13
20
|
|
|
14
21
|
export { execSyncVarlock };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { commandFn, commandSpec, formatShellValue } from './chunk-HMMDVPDG.js';
|
|
2
|
+
import './chunk-4A54P4EM.js';
|
|
3
|
+
import './chunk-QLNQ3KVC.js';
|
|
4
|
+
import './chunk-4JWJZ4P3.js';
|
|
5
|
+
import './chunk-CHQDS2PI.js';
|
|
6
|
+
import './chunk-CNDSEDGU.js';
|
|
7
|
+
import './chunk-5LNYCOEO.js';
|
|
8
|
+
import './chunk-6CCHLM3U.js';
|
|
9
|
+
import './chunk-XLYSNOR3.js';
|
|
10
|
+
import './chunk-6PEHRAEP.js';
|
|
11
|
+
//# sourceMappingURL=load.command-FNMIEIJB.js.map
|
|
12
|
+
//# sourceMappingURL=load.command-FNMIEIJB.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"load.command-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"load.command-FNMIEIJB.js"}
|
package/dist/plugin-lib.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { V as VarlockPlugin } from './env-graph-
|
|
2
|
-
export { C as CoercionError, D as Debugger, R as ResolutionError, a as Resolver, S as SchemaError, b as ValidationError, c as createDebug } from './env-graph-
|
|
1
|
+
import { V as VarlockPlugin } from './env-graph-BxA2OztA.js';
|
|
2
|
+
export { C as CoercionError, D as Debugger, R as ResolutionError, a as Resolver, S as SchemaError, b as ValidationError, c as createDebug } from './env-graph-BxA2OztA.js';
|
|
3
3
|
import '@env-spec/parser';
|
|
4
4
|
import '@env-spec/utils/type-utils';
|
|
5
5
|
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { commandFn, commandSpec } from './chunk-FVFI4EQN.js';
|
|
2
|
+
import './chunk-4A54P4EM.js';
|
|
3
|
+
import './chunk-QLNQ3KVC.js';
|
|
4
|
+
import './chunk-4JWJZ4P3.js';
|
|
5
|
+
import './chunk-CHQDS2PI.js';
|
|
6
|
+
import './chunk-CNDSEDGU.js';
|
|
7
|
+
import './chunk-5LNYCOEO.js';
|
|
8
|
+
import './chunk-6CCHLM3U.js';
|
|
9
|
+
import './chunk-XLYSNOR3.js';
|
|
10
|
+
import './chunk-6PEHRAEP.js';
|
|
11
|
+
//# sourceMappingURL=printenv.command-3HLXLNHS.js.map
|
|
12
|
+
//# sourceMappingURL=printenv.command-3HLXLNHS.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"printenv.command-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"printenv.command-3HLXLNHS.js"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { commandFn, commandSpec } from './chunk-ANZNVJLY.js';
|
|
2
|
+
import './chunk-4A54P4EM.js';
|
|
3
|
+
import './chunk-QLNQ3KVC.js';
|
|
4
|
+
import './chunk-4JWJZ4P3.js';
|
|
5
|
+
import './chunk-CHQDS2PI.js';
|
|
6
|
+
import './chunk-CNDSEDGU.js';
|
|
7
|
+
import './chunk-5LNYCOEO.js';
|
|
8
|
+
import './chunk-6CCHLM3U.js';
|
|
9
|
+
import './chunk-IMB5QAZS.js';
|
|
10
|
+
import './chunk-XLYSNOR3.js';
|
|
11
|
+
import './chunk-6PEHRAEP.js';
|
|
12
|
+
//# sourceMappingURL=run.command-SXM3J6GI.js.map
|
|
13
|
+
//# sourceMappingURL=run.command-SXM3J6GI.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"run.command-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"run.command-SXM3J6GI.js"}
|
package/dist/runtime/env.d.ts
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { commandFn, commandSpec, getGitFiles, scanFileForValues, walkDirectory } from './chunk-CS57IAAJ.js';
|
|
2
|
+
import './chunk-GXNQVEXD.js';
|
|
3
|
+
import './chunk-GGBNUVWR.js';
|
|
4
|
+
import './chunk-R54KUFZA.js';
|
|
5
|
+
import './chunk-4A54P4EM.js';
|
|
6
|
+
import './chunk-4JWJZ4P3.js';
|
|
7
|
+
import './chunk-CHQDS2PI.js';
|
|
8
|
+
import './chunk-CNDSEDGU.js';
|
|
9
|
+
import './chunk-5LNYCOEO.js';
|
|
10
|
+
import './chunk-6CCHLM3U.js';
|
|
11
|
+
import './chunk-XLYSNOR3.js';
|
|
12
|
+
import './chunk-6PEHRAEP.js';
|
|
13
|
+
//# sourceMappingURL=scan.command-PW7HYURX.js.map
|
|
14
|
+
//# sourceMappingURL=scan.command-PW7HYURX.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"scan.command-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"scan.command-PW7HYURX.js"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export { commandFn, commandSpec } from './chunk-ZB2JSJLY.js';
|
|
2
|
+
import './chunk-R54KUFZA.js';
|
|
3
|
+
import './chunk-4A54P4EM.js';
|
|
4
|
+
import './chunk-CHQDS2PI.js';
|
|
5
|
+
import './chunk-CNDSEDGU.js';
|
|
6
|
+
import './chunk-5LNYCOEO.js';
|
|
7
|
+
import './chunk-6CCHLM3U.js';
|
|
8
|
+
import './chunk-XLYSNOR3.js';
|
|
9
|
+
import './chunk-6PEHRAEP.js';
|
|
10
|
+
//# sourceMappingURL=telemetry.command-4HKKZK7N.js.map
|
|
11
|
+
//# sourceMappingURL=telemetry.command-4HKKZK7N.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"telemetry.command-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"telemetry.command-4HKKZK7N.js"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export { commandFn, commandSpec } from './chunk-NTGBMXQQ.js';
|
|
2
|
+
import './chunk-4A54P4EM.js';
|
|
3
|
+
import './chunk-QLNQ3KVC.js';
|
|
4
|
+
import './chunk-4JWJZ4P3.js';
|
|
5
|
+
import './chunk-CHQDS2PI.js';
|
|
6
|
+
import './chunk-CNDSEDGU.js';
|
|
7
|
+
import './chunk-5LNYCOEO.js';
|
|
8
|
+
import './chunk-6CCHLM3U.js';
|
|
9
|
+
import './chunk-XLYSNOR3.js';
|
|
10
|
+
import './chunk-6PEHRAEP.js';
|
|
11
|
+
//# sourceMappingURL=typegen.command-O6OXWCVX.js.map
|
|
12
|
+
//# sourceMappingURL=typegen.command-O6OXWCVX.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[],"names":[],"mappings":"","file":"typegen.command-
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"typegen.command-O6OXWCVX.js"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "varlock",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.3",
|
|
4
4
|
"description": "AI-safe .env files: Schemas for agents, Secrets for humans.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -129,7 +129,7 @@
|
|
|
129
129
|
"@types/bun": "^1.3.11",
|
|
130
130
|
"@types/node": "25.3.2",
|
|
131
131
|
"@types/semver": "^7.7.1",
|
|
132
|
-
"@varlock/ci-env-info": "^0.0.
|
|
132
|
+
"@varlock/ci-env-info": "^0.0.2",
|
|
133
133
|
"ansis": "^4.2.0",
|
|
134
134
|
"browser-or-node": "^3.0.0",
|
|
135
135
|
"ci-info": "^4.3.1",
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/cli/helpers/error-checks.ts"],"names":[],"mappings":";;;;;;AAQA,SAAS,yBAAyB,GAAA,EAAY;AAC5C,EAAA,IAAI,EAAE,GAAA,YAAe,YAAA,CAAA,IAAiB,CAAC,IAAI,QAAA,EAAU;AACrD,EAAA,MAAM,SAAS,GAAA,CAAI,QAAA;AACnB,EAAA,MAAM,UAAA,GAAa;AAAA,IACjB,MAAA,CAAO,OAAA;AAAA,IACP,CAAA,EAAG,aAAA,CAAM,IAAA,CAAK,GAAA,CAAI,OAAO,MAAA,CAAO,SAAA,GAAY,CAAC,CAAC,CAAC,CAAA,EAAG,aAAA,CAAM,GAAA,CAAI,GAAG,CAAC,CAAA;AAAA,GAClE,CAAE,KAAK,IAAI,CAAA;AAEX,EAAA,OAAA,CAAQ,MAAM,EAAE,CAAA;AAChB,EAAA,OAAA,CAAQ,KAAA,CAAM,CAAA,UAAA,EAAM,MAAA,CAAO,EAAE,CAAA,CAAA,EAAI,OAAO,UAAU,CAAA,CAAA,EAAI,MAAA,CAAO,SAAS,CAAA,CAAE,CAAA;AACxE,EAAA,OAAA,CAAQ,MAAM,UAAU,CAAA;AAC1B;AAXS,MAAA,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AA,EAAA,sBAAA,CAAA","file":"chunk-4KSIULUK.js","sourcesContent":["import ansis from 'ansis';\nimport { gracefulExit } from 'exit-hook';\nimport _ from '@env-spec/utils/my-dash';\nimport { EnvGraph, ConfigItem, FileBasedDataSource } from '../../env-graph';\nimport { getItemSummary, joinAndCompact } from '../../lib/formatting';\nimport { VarlockError } from '../../env-graph/lib/errors';\n\n\nfunction showErrorLocationDetails(err: Error) {\n if (!(err instanceof VarlockError) || !err.location) return;\n const errLoc = err.location;\n const errPreview = [\n errLoc.lineStr,\n `${ansis.gray('-'.repeat(errLoc.colNumber - 1))}${ansis.red('^')}`,\n ].join('\\n');\n\n console.error('');\n console.error(`📂 ${errLoc.id}:${errLoc.lineNumber}:${errLoc.colNumber}`);\n console.error(errPreview);\n}\n\nexport function checkForNoEnvFiles(envGraph: EnvGraph) {\n if (Object.keys(envGraph.configSchema).length === 0) {\n const displayPath = envGraph.basePath ?? process.cwd();\n const hasLoadedFiles = envGraph.sortedDataSources.some((s) => s instanceof FileBasedDataSource);\n if (!hasLoadedFiles) {\n console.error(`🚨 No .env files found in ${displayPath}\\n`);\n console.error('Run `varlock init` to create a .env.schema file, or use `--path` to specify a file or directory.');\n } else {\n console.error(`🚨 No config items defined in ${displayPath}\\n`);\n console.error('Add items to your .env.schema file to get started.');\n }\n return gracefulExit(1);\n }\n}\n\nexport function checkForSchemaErrors(envGraph: EnvGraph) {\n // first we check for loading/parse errors - some cases we may want to let it fail silently?\n for (const source of envGraph.sortedDataSources) {\n // do we care about loading errors from disabled sources?\n // if (source.disabled) continue;\n\n if (source.loadingError) {\n console.error(`🚨 Error encountered while loading ${source.label}\\n`);\n\n console.error(source.loadingError.message);\n showErrorLocationDetails(source.loadingError);\n\n // For plugin loading errors, show the full stack trace since it's usually\n // a runtime error from executing the plugin code\n if (source.loadingError.stack && !(source.loadingError instanceof VarlockError)) {\n console.error(`\\n${ansis.dim('Stack trace:')}`);\n console.error(ansis.dim(source.loadingError.stack));\n }\n\n return gracefulExit(1);\n }\n // TODO: unify this with the above!\n if (source.schemaErrors.length) {\n console.error(`🚨 Error(s) encountered in ${source.label}`);\n\n for (const schemaErr of source.schemaErrors) {\n console.error(`- ${schemaErr.message}`);\n showErrorLocationDetails(schemaErr);\n }\n return gracefulExit(1);\n }\n }\n\n // now we check for any schema errors - where something about how things are wired up is invalid\n // NOTE - we should not have run any resolution yet\n // TODO: make sure we are calling this before attempting to resolve values\n // const failingItems = _.filter(_.values(envGraph.configSchema), (item) => item.validationState === 'error');\n // if (failingItems.length > 0) {\n // throw new CliExitError('Schema is currently invalid');\n // }\n}\n\n\nexport function showPluginWarnings(envGraph: EnvGraph) {\n for (const plugin of envGraph.plugins) {\n if (!plugin.warnings.length) continue;\n for (const warning of plugin.warnings) {\n console.error(ansis.yellow(`[WARNING] ${warning.message}`));\n if (warning.tip) {\n for (const line of warning.tip.split('\\n')) {\n console.error(` ${line}`);\n }\n }\n }\n }\n}\n\nexport class InvalidEnvError extends Error {\n constructor() {\n super('Resolved config/env did not pass validation');\n }\n getFormattedOutput() {\n return `\\n💥 ${ansis.red(this.message)} 💥\\n`;\n }\n}\n\nexport function checkForConfigErrors(envGraph: EnvGraph, opts?: {\n showAll?: boolean;\n /** Log errors to stderr but don't throw — used when the caller will handle errors itself (e.g. json-full output) */\n noThrow?: boolean;\n}) {\n // check for root decorator \"execution\"\n for (const source of envGraph.sortedDataSources) {\n if (source.resolutionErrors.length) {\n console.error(`🚨 Root decorator error(s) in ${source.label}`);\n\n for (const err of source.resolutionErrors) {\n console.error(`- ${err.message}`);\n if (err instanceof VarlockError && err.tip) {\n for (const line of err.tip.split('\\n')) {\n console.error(` ${line}`);\n }\n }\n showErrorLocationDetails(err);\n }\n }\n }\n\n\n\n const failingItems = envGraph.sortedConfigKeys\n .map((k) => envGraph.configSchema[k])\n .filter((item) => item.validationState === 'error');\n\n // TODO: use service.isValid?\n if (failingItems.length > 0) {\n console.error(`\\n🚨 🚨 🚨 ${ansis.bold.underline('Configuration is currently invalid ')} 🚨 🚨 🚨\\n`);\n console.error('Invalid items:\\n');\n\n _.each(failingItems, (item: ConfigItem) => {\n console.error(getItemSummary(item));\n console.error();\n });\n if (opts?.showAll) {\n console.error();\n console.error(joinAndCompact([\n 'Valid items:',\n ansis.italic.gray('(remove `--show-all` flag to hide)'),\n ]));\n console.error();\n const validItems = envGraph.sortedConfigKeys\n .map((k) => envGraph.configSchema[k])\n .filter((i) => !!i.isValid);\n _.each(validItems, (item: ConfigItem) => {\n console.error(getItemSummary(item));\n });\n }\n\n showPluginWarnings(envGraph);\n if (!opts?.noThrow) {\n throw new InvalidEnvError();\n }\n }\n}\n"]}
|