@env-spec/parser 0.1.1 → 0.2.0
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-W7OLHAQY.js → chunk-CPCMOU6E.js} +37 -9
- package/dist/{chunk-W7OLHAQY.js.map → chunk-CPCMOU6E.js.map} +1 -1
- package/dist/{chunk-CO7WMO6T.mjs → chunk-XRNR4FE7.mjs} +37 -9
- package/dist/{chunk-CO7WMO6T.mjs.map → chunk-XRNR4FE7.mjs.map} +1 -1
- package/dist/{classes-BGIxXMLF.d.mts → classes-DHueAliY.d.mts} +8 -0
- package/dist/{classes-BGIxXMLF.d.ts → classes-DHueAliY.d.ts} +8 -0
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +147 -147
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/index.mjs.map +1 -1
- package/dist/simple-resolver.d.mts +1 -1
- package/dist/simple-resolver.d.ts +1 -1
- package/dist/simple-resolver.js +10 -10
- package/dist/simple-resolver.mjs +1 -1
- package/package.json +9 -7
package/dist/simple-resolver.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkCPCMOU6E_js = require('./chunk-CPCMOU6E.js');
|
|
4
4
|
var child_process = require('child_process');
|
|
5
5
|
|
|
6
6
|
function simpleResolver(parsedEnvFile, opts) {
|
|
7
7
|
const resolved = {};
|
|
8
8
|
function valueResolver(valOrFn) {
|
|
9
|
-
if (valOrFn instanceof
|
|
10
|
-
if (valOrFn instanceof
|
|
9
|
+
if (valOrFn instanceof chunkCPCMOU6E_js.ParsedEnvSpecStaticValue) return valOrFn.unescapedValue;
|
|
10
|
+
if (valOrFn instanceof chunkCPCMOU6E_js.ParsedEnvSpecFunctionCall) {
|
|
11
11
|
if (valOrFn.name === "ref") {
|
|
12
12
|
const args = valOrFn.simplifiedArgs;
|
|
13
13
|
if (Array.isArray(args)) {
|
|
@@ -19,9 +19,9 @@ function simpleResolver(parsedEnvFile, opts) {
|
|
|
19
19
|
} else if (valOrFn.name === "concat") {
|
|
20
20
|
const args = valOrFn.data.args.values;
|
|
21
21
|
const resolvedArgs = args.map((i) => {
|
|
22
|
-
if (i instanceof
|
|
22
|
+
if (i instanceof chunkCPCMOU6E_js.ParsedEnvSpecStaticValue) {
|
|
23
23
|
return valueResolver(i);
|
|
24
|
-
} else if (i instanceof
|
|
24
|
+
} else if (i instanceof chunkCPCMOU6E_js.ParsedEnvSpecFunctionCall) {
|
|
25
25
|
return valueResolver(i);
|
|
26
26
|
} else {
|
|
27
27
|
throw new Error("Invalid concat args");
|
|
@@ -44,7 +44,7 @@ function simpleResolver(parsedEnvFile, opts) {
|
|
|
44
44
|
} else if (valOrFn.name === "fallback") {
|
|
45
45
|
const args = valOrFn.data.args.values;
|
|
46
46
|
for (const arg of args) {
|
|
47
|
-
if (arg instanceof
|
|
47
|
+
if (arg instanceof chunkCPCMOU6E_js.ParsedEnvSpecKeyValuePair) {
|
|
48
48
|
throw new Error("Invalid `fallback` arg - should not be key-value pair");
|
|
49
49
|
}
|
|
50
50
|
const resolvedArg = valueResolver(arg);
|
|
@@ -53,10 +53,10 @@ function simpleResolver(parsedEnvFile, opts) {
|
|
|
53
53
|
return void 0;
|
|
54
54
|
} else if (valOrFn.name === "remap") {
|
|
55
55
|
const args = valOrFn.data.args.data.values;
|
|
56
|
-
if (!(args[0] instanceof
|
|
56
|
+
if (!(args[0] instanceof chunkCPCMOU6E_js.ParsedEnvSpecStaticValue) && !(args[0] instanceof chunkCPCMOU6E_js.ParsedEnvSpecFunctionCall)) throw new Error("Expected first arg to be a static value or function call");
|
|
57
57
|
const val = valueResolver(args[0]);
|
|
58
58
|
for (const remapArg of args.slice(1)) {
|
|
59
|
-
if (!(remapArg instanceof
|
|
59
|
+
if (!(remapArg instanceof chunkCPCMOU6E_js.ParsedEnvSpecKeyValuePair)) {
|
|
60
60
|
throw new Error("`remap` args after first should all be key-value pairs");
|
|
61
61
|
}
|
|
62
62
|
const remapVal = valueResolver(remapArg.value);
|
|
@@ -68,7 +68,7 @@ function simpleResolver(parsedEnvFile, opts) {
|
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
|
|
71
|
+
chunkCPCMOU6E_js.__name(valueResolver, "valueResolver");
|
|
72
72
|
for (const item of parsedEnvFile.configItems) {
|
|
73
73
|
if (opts?.env[item.key]) {
|
|
74
74
|
resolved[item.key] = opts.env[item.key];
|
|
@@ -83,7 +83,7 @@ function simpleResolver(parsedEnvFile, opts) {
|
|
|
83
83
|
}
|
|
84
84
|
return resolved;
|
|
85
85
|
}
|
|
86
|
-
|
|
86
|
+
chunkCPCMOU6E_js.__name(simpleResolver, "simpleResolver");
|
|
87
87
|
|
|
88
88
|
exports.simpleResolver = simpleResolver;
|
|
89
89
|
//# sourceMappingURL=simple-resolver.js.map
|
package/dist/simple-resolver.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { __name, ParsedEnvSpecStaticValue, ParsedEnvSpecFunctionCall, ParsedEnvSpecKeyValuePair } from './chunk-
|
|
1
|
+
import { __name, ParsedEnvSpecStaticValue, ParsedEnvSpecFunctionCall, ParsedEnvSpecKeyValuePair } from './chunk-XRNR4FE7.mjs';
|
|
2
2
|
import { execSync } from 'child_process';
|
|
3
3
|
|
|
4
4
|
function simpleResolver(parsedEnvFile, opts) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@env-spec/parser",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Parser for @env-spec enabled dotenv files",
|
|
5
5
|
"homepage": "https://varlock.dev",
|
|
6
6
|
"bugs": "https://github.com/dmno-dev/varlock/issues",
|
|
@@ -10,7 +10,9 @@
|
|
|
10
10
|
"directory": "packages/env-spec-parser"
|
|
11
11
|
},
|
|
12
12
|
"main": "dist/index.js",
|
|
13
|
-
"files": [
|
|
13
|
+
"files": [
|
|
14
|
+
"dist"
|
|
15
|
+
],
|
|
14
16
|
"exports": {
|
|
15
17
|
".": {
|
|
16
18
|
"ts-src": "./src/index.ts",
|
|
@@ -46,12 +48,12 @@
|
|
|
46
48
|
"node": ">=22"
|
|
47
49
|
},
|
|
48
50
|
"devDependencies": {
|
|
49
|
-
"@types/node": "
|
|
50
|
-
"ansis": "
|
|
51
|
+
"@types/node": "25.3.2",
|
|
52
|
+
"ansis": "^4.2.0",
|
|
51
53
|
"npm-run-all": "^4.1.5",
|
|
52
|
-
"outdent": "
|
|
54
|
+
"outdent": "^0.8.0",
|
|
53
55
|
"peggy": "^5.0.6",
|
|
54
|
-
"tsup": "
|
|
55
|
-
"vitest": "
|
|
56
|
+
"tsup": "^8.5.1",
|
|
57
|
+
"vitest": "^4.0.18"
|
|
56
58
|
}
|
|
57
59
|
}
|