@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.
@@ -1,4 +1,4 @@
1
- import { P as ParsedEnvSpecFile } from './classes-BhsV2JNw.mjs';
1
+ import { P as ParsedEnvSpecFile } from './classes-BlcAw7bS.mjs';
2
2
 
3
3
  /**
4
4
  * very simple resolver meant to be used for testing
@@ -1,4 +1,4 @@
1
- import { P as ParsedEnvSpecFile } from './classes-BhsV2JNw.js';
1
+ import { P as ParsedEnvSpecFile } from './classes-BlcAw7bS.js';
2
2
 
3
3
  /**
4
4
  * very simple resolver meant to be used for testing
@@ -1,13 +1,13 @@
1
1
  'use strict';
2
2
 
3
- var chunkX4PJ2KLO_js = require('./chunk-X4PJ2KLO.js');
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 chunkX4PJ2KLO_js.ParsedEnvSpecStaticValue) return valOrFn.unescapedValue;
10
- if (valOrFn instanceof chunkX4PJ2KLO_js.ParsedEnvSpecFunctionCall) {
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 chunkX4PJ2KLO_js.ParsedEnvSpecStaticValue) {
22
+ if (i instanceof chunkEWY3F3XT_js.ParsedEnvSpecStaticValue) {
23
23
  return valueResolver(i);
24
- } else if (i instanceof chunkX4PJ2KLO_js.ParsedEnvSpecFunctionCall) {
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 chunkX4PJ2KLO_js.ParsedEnvSpecKeyValuePair) {
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 chunkX4PJ2KLO_js.ParsedEnvSpecStaticValue) && !(args[0] instanceof chunkX4PJ2KLO_js.ParsedEnvSpecFunctionCall)) throw new Error("Expected first arg to be a static value or function call");
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 chunkX4PJ2KLO_js.ParsedEnvSpecKeyValuePair || resultArg instanceof chunkX4PJ2KLO_js.ParsedEnvSpecKeyValuePair) {
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 chunkX4PJ2KLO_js.ParsedEnvSpecKeyValuePair) {
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
- chunkX4PJ2KLO_js.__name(valueResolver, "valueResolver");
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
- chunkX4PJ2KLO_js.__name(simpleResolver, "simpleResolver");
96
+ chunkEWY3F3XT_js.__name(simpleResolver, "simpleResolver");
97
97
 
98
98
  exports.simpleResolver = simpleResolver;
99
99
  //# sourceMappingURL=simple-resolver.js.map
@@ -1,4 +1,4 @@
1
- import { __name, ParsedEnvSpecStaticValue, ParsedEnvSpecFunctionCall, ParsedEnvSpecKeyValuePair } from './chunk-N4D6RSUR.mjs';
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) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@env-spec/parser",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
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",