@env-spec/parser 0.3.2 → 0.3.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/{chunk-N4D6RSUR.mjs → chunk-5ODZC3GU.mjs} +4 -4
- package/dist/{chunk-N4D6RSUR.mjs.map → chunk-5ODZC3GU.mjs.map} +1 -1
- package/dist/{chunk-X4PJ2KLO.js → chunk-EWY3F3XT.js} +4 -4
- package/dist/{chunk-X4PJ2KLO.js.map → chunk-EWY3F3XT.js.map} +1 -1
- package/dist/{classes-BhsV2JNw.d.mts → classes-BlcAw7bS.d.mts} +3 -3
- package/dist/{classes-BhsV2JNw.d.ts → classes-BlcAw7bS.d.ts} +3 -3
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +625 -483
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +498 -356
- 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 +11 -11
- package/dist/simple-resolver.mjs +1 -1
- package/package.json +1 -1
package/dist/simple-resolver.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkEWY3F3XT_js = require('./chunk-EWY3F3XT.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 chunkEWY3F3XT_js.ParsedEnvSpecStaticValue) return valOrFn.unescapedValue;
|
|
10
|
+
if (valOrFn instanceof chunkEWY3F3XT_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 chunkEWY3F3XT_js.ParsedEnvSpecStaticValue) {
|
|
23
23
|
return valueResolver(i);
|
|
24
|
-
} else if (i instanceof
|
|
24
|
+
} else if (i instanceof chunkEWY3F3XT_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 chunkEWY3F3XT_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,13 +53,13 @@ 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 chunkEWY3F3XT_js.ParsedEnvSpecStaticValue) && !(args[0] instanceof chunkEWY3F3XT_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
|
const remainingArgs = args.slice(1);
|
|
59
59
|
for (let i = 0; i + 1 < remainingArgs.length; i += 2) {
|
|
60
60
|
const matchArg = remainingArgs[i];
|
|
61
61
|
const resultArg = remainingArgs[i + 1];
|
|
62
|
-
if (matchArg instanceof
|
|
62
|
+
if (matchArg instanceof chunkEWY3F3XT_js.ParsedEnvSpecKeyValuePair || resultArg instanceof chunkEWY3F3XT_js.ParsedEnvSpecKeyValuePair) {
|
|
63
63
|
throw new Error("`remap` args should not be key-value pairs");
|
|
64
64
|
}
|
|
65
65
|
const matchVal = valueResolver(matchArg);
|
|
@@ -67,7 +67,7 @@ function simpleResolver(parsedEnvFile, opts) {
|
|
|
67
67
|
}
|
|
68
68
|
if (remainingArgs.length % 2 === 1) {
|
|
69
69
|
const defaultArg = remainingArgs[remainingArgs.length - 1];
|
|
70
|
-
if (defaultArg instanceof
|
|
70
|
+
if (defaultArg instanceof chunkEWY3F3XT_js.ParsedEnvSpecKeyValuePair) {
|
|
71
71
|
throw new Error("`remap` args should not be key-value pairs");
|
|
72
72
|
}
|
|
73
73
|
return valueResolver(defaultArg);
|
|
@@ -78,7 +78,7 @@ function simpleResolver(parsedEnvFile, opts) {
|
|
|
78
78
|
}
|
|
79
79
|
}
|
|
80
80
|
}
|
|
81
|
-
|
|
81
|
+
chunkEWY3F3XT_js.__name(valueResolver, "valueResolver");
|
|
82
82
|
for (const item of parsedEnvFile.configItems) {
|
|
83
83
|
if (opts?.env[item.key]) {
|
|
84
84
|
resolved[item.key] = opts.env[item.key];
|
|
@@ -93,7 +93,7 @@ function simpleResolver(parsedEnvFile, opts) {
|
|
|
93
93
|
}
|
|
94
94
|
return resolved;
|
|
95
95
|
}
|
|
96
|
-
|
|
96
|
+
chunkEWY3F3XT_js.__name(simpleResolver, "simpleResolver");
|
|
97
97
|
|
|
98
98
|
exports.simpleResolver = simpleResolver;
|
|
99
99
|
//# 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-5ODZC3GU.mjs';
|
|
2
2
|
import { execSync } from 'child_process';
|
|
3
3
|
|
|
4
4
|
function simpleResolver(parsedEnvFile, opts) {
|